function LabeledMarker(A){this.labelText_=A.labelText||"";
this.labelClass_=A.labelClass||"LabeledMarker_markerLabel";
this.title_=A.title||"";
this.htmlId_=A.htmlId||"generalpoi_"+Math.floor(Math.random()*999999999);
google.maps.Marker.apply(this,arguments);
this.map_=A.map;
this.div_=null
}LabeledMarker.prototype=new google.maps.OverlayView();
LabeledMarker.prototype.onAdd=function(){this.div_=document.createElement("div");
this.div_.className=this.labelClass_;
this.div_.innerHTML=this.labelText_;
this.div_.id=this.htmlId_;
this.div_.style.position="absolute";
this.div_.title=this.title_;
var A=this.getPanes();
A.overlayLayer.appendChild(this.div_);
if(typeof this.OnDraw=="function"){this.OnDraw()
}};LabeledMarker.prototype.onRemove=function(){this.div_.parentNode.removeChild(this.div_);
this.div_=null
};LabeledMarker.prototype.hide=function(){if(this.div_){this.div_.style.visibility="hidden"
}};LabeledMarker.prototype.show=function(){if(this.div_){this.div_.style.visibility="visible"
}};LabeledMarker.prototype.toggle=function(){if(this.div_){if(this.div_.style.visibility=="hidden"){this.show()
}else{this.hide()
}}};LabeledMarker.prototype.toggleDOM=function(){if(this.getMap()){this.setMap(null)
}else{this.setMap(this.map_)
}};LabeledMarker.prototype.draw=function(){var A=this.getProjection();
var C=A.fromLatLngToDivPixel(this.position);
var B=this.div_;
B.style.left=C.x+"px";
B.style.top=C.y+"px"
};if(!("console" in window)){var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];
window.console={};
for(var i=0;
i<names.length;
++i){window.console[names[i]]=function(){}
}}ELEMENTSTOHIDEONMODALWINDOWSHOWING=[];
CustomW=Class.create();
CustomW.prototype=Object.extend(CustomW,{initialize:Prototype.emptyFunction,setToPixel:function(A){return parseInt(A)+"px"
}});CustomW.Window=Class.create();
CustomW.Window.prototype=Object.extend(CustomW.Window,{initialize:function(A){this.options=Object.clone(A);
this.options.parent=$(this.options.parent)||$(document.body);
this.options.className=this.options.className||"customwin";
this.options.id=this.options.id||"window_"+generateRandomId();
this.options.destroyOnClose=this.options.destroyOnClose||false;
this.options.cornerWidth=this.options.cornerWidth||0;
this.options.cornerHeight=this.options.cornerHeight||0;
this.window={};
CustomW.Windows.register(this);
this.buildHTML();
if((this.options.top!=null||this.options.bottom!=null)&&(this.options.left!=null||this.options.right!=null)){this.setLocation(this.options.top,this.options.left,this.options.bottom,this.options.right)
}if(this.options.width&&this.options.height){this.width=this.options.width;
this.height=this.options.height
}this.visible=false
},buildHTML:function(){this.window.frame=$(new Element("div",{className:this.options.className,id:this.options.id,style:"display: none"}));
var A='<div class="buttons"><div class="closeBtn" id="'+this.options.id+'-closeBtn"><div class="bg transppngasbg"></div></div><div class="maximizeBtn" id="'+this.options.id+'-maximizeBtn"><div class="bg transppngasbg"></div></div><div class="minimizeBtn" id="'+this.options.id+'-minimizeBtn"><div class="bg transppngasbg"></div></div></div>';
A+='<div class="top clearfix"><div class="tl transppngasbg"></div><div class="tc" id="'+this.options.id+'-tc"><div class="bg transppngasbg"></div></div><div class="tr transppngasbg"></div></div>';
A+='<div class="middle clearfix"><div class="ml" id="'+this.options.id+'-ml"><div class="bg transppngasbg"></div></div><div class="mr" id="'+this.options.id+'-mr"><div class="bg transppngasbg"></div></div>';
A+='<div class="header" id="'+this.options.id+'-header"></div>';
A+='<div class="content" id="'+this.options.id+'-content"><div class="innercontent" id="'+this.options.id+'-innerContent"></div></div>';
A+='<div class="footer" id="'+this.options.id+'-footer"></div></div>';
A+='<div class="bottom clearfix"><div class="bl transppngasbg"></div><div class="bc" id="'+this.options.id+'-bc"><div class="bg transppngasbg"></div></div><div class="br transppngasbg"></div></div>';
this.window.frame.innerHTML=A;
if(this.options.showModal){if(!$("customWModalBg")){var B=this.options.zIndex||0;
this.modalBG=new Element("div",{className:"customWModalBg",style:"display: none; z-index: "+B});
$(document.body).insert(this.modalBG)
}}this.options.parent.insert(this.window.frame);
this.window.content=$(this.options.id+"-content");
this.window.innerContent=$(this.options.id+"-innerContent");
this.window.header=$(this.options.id+"-header");
this.window.footer=$(this.options.id+"-footer");
this.window.closeBtn=$(this.options.id+"-closeBtn");
this.window.closeBtn.observe("mousedown",function(){this.window.closeBtn.className="closeBtn click"
}.bind(this));
this.window.closeBtn.observe("mouseover",function(){this.window.closeBtn.className="closeBtn hover"
}.bind(this));
this.window.closeBtn.observe("mouseout",function(){this.window.closeBtn.className="closeBtn"
}.bind(this));
this.window.closeBtn.observe("click",this.close.bindAsEventListener(this));
this.window.maximizeBtn=$(this.options.id+"-maximizeBtn");
if(this.options.onMaximize){this.window.maximizeBtn.observe("mousedown",function(){this.window.maximizeBtn.className="maximizeBtn click"
}.bind(this));
this.window.maximizeBtn.observe("mouseover",function(){this.window.maximizeBtn.className="maximizeBtn hover"
}.bind(this));
this.window.maximizeBtn.observe("mouseout",function(){this.window.maximizeBtn.className="maximizeBtn"
}.bind(this));
this.window.maximizeBtn.observe("click",this.options.onMaximize)
}else{this.window.maximizeBtn.hide()
}this.window.minimizeBtn=$(this.options.id+"-minimizeBtn");
if(this.options.onMinimize){this.window.minimizeBtn.observe("mousedown",function(){this.window.minimizeBtn.className="minimizeBtn click"
}.bind(this));
this.window.minimizeBtn.observe("mouseover",function(){this.window.minimizeBtn.className="minimizeBtn hover"
}.bind(this));
this.window.minimizeBtn.observe("mouseout",function(){this.window.minimizeBtn.className="minimizeBtn"
}.bind(this));
this.window.minimizeBtn.observe("click",this.options.onMinimize)
}else{this.window.minimizeBtn.hide()
}if(this.options.zIndex){this.window.frame.setStyle({zIndex:this.options.zIndex})
}},setHTMLHeader:function(B,A){this.window.header.update(B);
if(A){this.resize()
}},setHTMLFooter:function(B,A){this.window.footer.update(B);
if(A){this.resize()
}},setHTMLContent:function(D,A){if(this.options.buttons){D+="<br />";
for(var C=0;
C<this.options.buttons.length;
C++){var B=this.options.buttons[C];
D+='<button class="simpleButton '+B.className+'" id ="'+this.getId()+"_"+B.id+'">'+B.label+"</button>"
}}this.window.innerContent.update(D);
if(this.options.buttons){for(var C=0;
C<this.options.buttons.length;
C++){var B=this.options.buttons[C];
var E=this.getId()+"_"+B.id;
if($(E)){if(B.onClick){$(E).observe("click",B.onClick)
}}}}if(A){this.resize()
}},setVisibilityOfHideableElements:function(C){for(var A=0;
A<ELEMENTSTOHIDEONMODALWINDOWSHOWING.length;
A++){var B=$(ELEMENTSTOHIDEONMODALWINDOWSHOWING[A]);
if(B){B.setStyle({visibility:(C)?"visible":"hidden"})
}}},show:function(){if(this.options.recenterAuto){this.recenter()
}this.window.frame.show();
this.visible=true;
this.showModalBg();
if(typeof this.options.onShow=="function"){this.options.onShow.call()
}this.resize()
},showModalBg:function(){if(!this.modalBG){return 
}this.modalBG.show();
this.modalBG.setOpacity(0.6);
this.modalBG.setStyle({height:(new Environment()).pageHeight()+"px"});
this.setVisibilityOfHideableElements(false)
},close:function(A){if(A){Event.stop(A)
}if(this.options.destroyOnClose){this.destroy()
}else{this.hide()
}if(typeof this.options.onClose=="function"){this.options.onClose.call()
}},hide:function(){this.window.frame.hide();
if(this.modalBG){this.modalBG.hide();
this.setVisibilityOfHideableElements(true)
}this.visible=false
},isVisible:function(){return this.visible
},setLocation:function(D,C,A,B){if(!this.options.recenterAuto){var E={};
if(!isNaN(D)){E.top=parseInt(D)+"px"
}else{E.bottom=parseInt(A)+"px"
}if(!isNaN(C)){E.left=parseInt(C)+"px"
}else{E.right=parseInt(B)+"px"
}this.window.frame.setStyle(E)
}},getLocation:function(B,A){return[this.window.frame.getStyle("left"),this.window.frame.getStyle("top")]
},recenter:function(){var B=[];
var A=new Environment();
if(this.options.parent==document.body){B[0]=browser.windowWidth()+(A.scrollX()*2);
B[1]=browser.windowHeight()+(A.scrollY()*2)
}else{B[0]=this.options.parent.getWidth();
B[1]=this.options.parent.getHeight()
}this.window.frame.setStyle({left:Math.abs(Math.floor((B[0]-this.getSize()[0])/2))+"px",top:Math.abs(Math.floor((B[1]-this.getSize()[1])/2))+"px"})
},centerAbsolute:function(B){var C=Position.cumulativeOffset(B);
var A=B.getDimensions();
this.window.frame.setStyle({left:(C[0]+Math.floor((A.width-this.getSize()[0])/2))+"px",top:(C[1]+Math.floor((A.height-this.getSize()[1])/2))+"px"})
},resize:function(){this.setSize(this.width,this.height)
},setSize:function(C,A){this.width=parseInt(C);
this.height=parseInt(A);
this.window.frame.setStyle({width:this.width+"px",height:this.height+"px"});
var B=this.width-(this.options.cornerWidth*2);
var D=this.height-(this.options.cornerHeight*2);
$(this.getId()+"-tc").setStyle({width:B+"px"});
$(this.getId()+"-ml").setStyle({height:D+"px"});
$(this.getId()+"-mr").setStyle({height:D+"px"});
this.window.content.setStyle({height:D-this.window.header.getHeight()-this.window.footer.getHeight()+"px",width:B+"px"});
$(this.getId()+"-bc").setStyle({width:B+"px"})
},getSize:function(){return[this.width,this.height]
},getRealsize:function(){return[this.window.frame.getWidth(),this.window.frame.getHeight()]
},getId:function(){return this.window.frame.id
},destroy:function(){this.visible=false;
if(this.modalBG){this.modalBG.remove();
this.setVisibilityOfHideableElements(true)
}if(this.window.frame){this.window.frame.remove()
}CustomW.Windows.unregister(this.window);
this.modalBG=null;
this.window.frame=null
}});CustomW.Windows={register:function(A){if(!CustomW.Windows.windows){CustomW.Windows.windows=[]
}CustomW.Windows.windows.push(A)
},unregister:function(A){CustomW.Windows.windows=CustomW.Windows.windows.reject(function(B){return B==A
});delete A
}};Environment=Class.create({Browser:function(){var A=navigator.appName;
if(A=="Netscape"){this.b="ns"
}else{if(A=="Microsoft Internet Explorer"){this.b="ie"
}else{if(A=="Opera"){this.b="op"
}else{this.b=A
}}}this.v=parseInt(navigator.appVersion);
this.ns=(this.b=="ns"&&this.v>=4);
this.ns4=(this.b=="ns"&&this.v==4);
this.ns5=(this.b=="ns"&&this.v==5);
this.ie=(this.b=="ie"&&this.v>=4);
this.op=(this.b=="op"&&this.v>=7);
this.ie4=(navigator.userAgent.indexOf("MSIE 4")>0);
this.ie5=(navigator.userAgent.indexOf("MSIE 5")>0);
this.ie55=(navigator.userAgent.indexOf("MSIE 5.5")>0);
if(this.ie55){this.v=5.5;
this.ie5=false
}this.ie6=(navigator.userAgent.indexOf("MSIE 6")>0);
this.ie7=(navigator.userAgent.indexOf("MSIE 7")>0);
this.mac=(navigator.userAgent.indexOf("Mac")>0);
if(this.ie5){this.v=5
}this.min=(this.ns||this.ie);
this.safari=(navigator.userAgent.indexOf("Safari")>0);
return this
},pageHeight:function(){return document.body.scrollHeight
},pageWidth:function(){return document.body.scrollWidth
},scrollTo:function(A,B){window.scrollTo(A,B)
},scrollX:function(){var A=document.documentElement;
return self.pageXOffset||(A&&A.scrollLeft)||document.body.scrollLeft
},scrollY:function(){var A=document.documentElement;
return self.pageYOffset||(A&&A.scrollTop)||document.body.scrollTop
},windowHeight:function(){var A=document.documentElement;
return self.innerHeight||(A&&A.clientHeight)||document.body.clientHeight
},windowWidth:function(){var A=document.documentElement;
return self.innerWidth||(A&&A.clientWidth)||document.body.clientWidth
}});var env=new Environment();
var isBrowser=env.Browser();
var browser=isBrowser;
isRealMouseEventTarget=function(C,B){if(!C){return true
}var A;
var D=false;
if(C.type=="mouseout"){A=C.relatedTarget?C.relatedTarget:C.toElement;
if(!A||(A!=B&&!Element.descendantOf(A,B))){D=true
}}else{if(C.type=="mouseover"){A=C.relatedTarget?C.relatedTarget:C.fromElement;
if(!A||(A!=B&&!Element.descendantOf(A,B))){D=true
}}else{throw new Error("event is neither mouseover nor mouseout")
}}return D
};generateRandomIdBy="abcdefghijklmnopqrstuvwxyz0123456789";
generateRandomId=function(B){B=B||30;
var A="";
do{for(i=0;
i<B;i++){A+=generateRandomIdBy.charAt(Math.random()*generateRandomIdBy.length)
}}while($(A));
return A
};function setTabStop(A){var A=$(A);
Event.observe(A,"keypress",_setTabStop)
}function _setTabStop(A){if(A.keyCode==Event.KEY_TAB){A.stop();
A.element(A).focus()
}}faderEffect=Class.create({defaultDecreaser:-0.05,defaultIncreaser:-0.05,fadeOutAfterMs:2000,fadeOutContinuouslyMs:30,initialize:function(A){this.element=$(A)
},fadeOut:function(){this.element.show();
this.element.setOpacity(1);
setTimeout(function(){this.timer(this.defaultDecreaser,0)
}.bind(this),this.fadeOutAfterMs)
},timer:function(B,A){if(this.element.getOpacity()==A){this.element.hide();
return 
}this.element.setOpacity(this.element.getOpacity()+B);
setTimeout(function(){this.timer(B,A)
}.bind(this),this.fadeOutContinuouslyMs)
}});CSS={getRule:function(D,F){if(document.styleSheets){for(var B=0;
B<document.styleSheets.length;
B++){var E=document.styleSheets[B];
var C=0;
var A=false;
do{if(E.cssRules){A=E.cssRules[C]
}else{A=E.rules[C]
}if(A){if(A.selectorText==D){if(F=="delete"){if(E.cssRules){E.deleteRule(C)
}else{E.removeRule(C)
}return true
}else{return A
}}}C++
}while(A)
}}return false
},killRule:function(A){return CSS.getRule(A,"delete")
},addRule:function(A){if(document.styleSheets){if(!CSS.getRule(A)){if(document.styleSheets[0].addRule){document.styleSheets[0].addRule(A,null,0)
}else{document.styleSheets[0].insertRule(A+" { }",0)
}}}return CSS.getRule(A)
}};function openECS(C,A){var B=window.open("/clicktocall.jspv?method=ClickToCall&advertid="+C+"&advertFreeCallId="+A,"ECS","width=600,height=280,menubar=no,status=no,toolbar=no,resizable=no");
if(!B){mtt.showMessage(mtt.lang.popupBlockerDetected)
}return false
}function openBookTable(B){var A=window.open("/framecontents/asztalfoglalas.jspv?advert="+B,"BookTable","width=600,height=400,menubar=no,status=no,toolbar=no,resizable=no,scrollbars=yes");
if(!A){mtt.showMessage(mtt.lang.popupBlockerDetected)
}return false
}function openBookRoom(B){var A=window.open("/framecontents/szobafoglalas.jspv?advert="+B,"BookRoom","width=600,height=400,menubar=no,status=no,toolbar=no,resizable=no,scrollbars=yes");
if(!A){mtt.showMessage(mtt.lang.popupBlockerDetected)
}return false
}function openEmailForm(B){var A=window.open("/framecontents/emailform.jspv?advert="+B,"EmailForm","width=600,height=400,menubar=no,status=no,toolbar=no,resizable=no,scrollbars=yes");
if(!A){mtt.showMessage(mtt.lang.popupBlockerDetected)
}return false
}function openPopup(C,D,A,B){var B=B||{};
B.menubar=B.menubar||"no";
B.status=B.status||"no";
B.toolbar=B.toolbar||"no";
B.resizable=B.resizable||"no";
B.scrollbars=B.scrollbars||"yes";
var E=window.open(C,"popup","width="+D+",height="+A+",menubar="+B.menubar+",status="+B.status+",toolbar="+B.toolbar+",resizable="+B.resizable+",scrollbars="+B.scrollbars);
if(!E){mtt.showMessage(mtt.lang.popupBlockerDetected)
}return false
}stdPopup=Class.create({initialize:function(E,D,C,B,A){this.elem=$(E);
this.popup=$(D);
this.topE=$(C);
this.bottomE=$(B);
this.options=Object.clone(A);
this.options.hideDelay=this.options.hideDelay||100;
if(!this.elem||!this.popup){return 
}this.elem.observe("mouseover",this.show.bind(this));
this.elem.observe("mouseout",this.hide.bind(this));
this.popup.observe("mouseover",this.show.bind(this));
this.popup.observe("mouseout",this.hide.bind(this))
},show:function(){if(this.hidingTimer){clearTimeout(this.hidingTimer);
delete this.hidingTimer
}var C=this.elem.cumulativeOffset()[0];
var B=this.elem.cumulativeOffset()[1];
var A=document.viewport.getScrollOffsets()[1];
var D=document.viewport.getHeight();
if(A+D<B+this.popup.getHeight()+20){this.popup.addClassName("reversed");
this.popup.setStyle({left:C+"px",top:B-this.popup.getHeight()+"px"});
this.topE&&this.topE.show();
this.bottomE&&this.bottomE.hide()
}else{this.popup.removeClassName("reversed");
this.popup.setStyle({left:C+"px",top:B+"px"});
this.topE&&this.topE.hide();
this.bottomE&&this.bottomE.show()
}this.popup.show()
},hide:function(){this.hidingTimer=setTimeout(function(){this.popup&&this.popup.hide();
delete this.hidingTimer
}.bind(this),this.options.hideDelay)
},destroy:function(){this.hide();
this.elem&&this.elem.stopObserving();
this.popup&&this.popup.stopObserving()
}});var navTabClass="TabNav";
var navTabSelectedClass="selectedTab";
var defaultTabId="defaultTab";
var preventDefaultEventonTabSelect=1;
function showTab(E){var D,G,F,A,B;
elm=$(E);
if(elm.tagName=="A"){F=elm.parentNode;
A=elm}else{F=elm;
A=elm.firstDescendant()
}D=A.readAttribute("href").strip();
F.siblings().invoke("removeClassName",navTabSelectedClass);
F.addClassName(navTabSelectedClass);
if(D.startsWith("#")){B=D.substring(1);
var C=$(B);
C.siblings().invoke("hide");
C.show()
}$("activeTab").value=D.substring(1);
disableInputs(D.substring(1));
C.up("form").action=C.down(".searchButtonValue").value;
if($("serviceSearch")||$("personSearch")){if(!($("serviceSearch").visible()||$("personSearch").visible())){mtt.searchForm.simple()
}}if($("personSearch")){if($("activeTab").value=="personSearch"&&$("mapSearchLinkPerson").hasClassName("selected")){$("serviceSearchForm").action=$$(".searchMode input")[1].value
}}if($("serviceSearch")&&$("mapSearchLink")){if($("activeTab").value=="serviceSearch"&&$("mapSearchLink").hasClassName("selected")){$("serviceSearchForm").action=$$(".searchMode input")[1].value
}}}function disableInputs(A){["personSearch","serviceSearch","addressSearch","routeSearch","phoneSearch"].each(function(B){$$("#"+B+" input").invoke("disable")
});$$("#"+A+" input").invoke("enable")
}function urlStringToParamObjs(C){var B={};
var F,A=/\+/g,D=/([^&=]+)=?([^&]*)/g,G=function(H){return decodeURIComponent(H.replace(A," "))
},E=C.substring(1);
while(F=D.exec(E)){B[G(F[1])]=G(F[2])
}return{url:C.substring(0,C.indexOf("?")),params:B}
}function showTabEvent(A){if(!A.element().up().hasClassName("help")){var C=A.element();
showTab(C);
var B=$("mainMenu");
if(B){$("mainMenu").setStyle("position:static")
}if(preventDefaultEventonTabSelect){A.preventDefault()
}}}function markEvent(B){var A=Event.element(B);
A.style.color="green"
}var defaultValue=Class.create();
defaultValue.prototype={initialize:function(A){this.element=A;
this.defaultValue=this.element.getAttribute("rel")||this.element.getAttribute("title");
if(!this.defaultValue||this.element.defaultValueObj){return 
}this.defaultValue=this.defaultValue.escapeHTML();
this.element.defaultValueObj=this;
Event.observe(this.element,"focus",this.updateState.bind(this));
Event.observe(this.element,"blur",this.updateState.bind(this));
Event.observe(this.element,"keypress",this.updateState.bind(this));
this.element._modified=this.element.value!="";
this.updateState({type:"blur"})
},updateState:function(A){if(A.type=="blur"){if(this.element.value==""){this.element.addClassName("showDefaultValue");
this.element._modified=false;
this.element.value=this.defaultValue
}}else{if(A.type=="focus"){if(!this.element._modified){this.element.removeClassName("showDefaultValue");
this.element.value=""
}}else{if(A.type=="keypress"){if(this.element.value==""){this.element._modified=false
}else{this.element._modified=true
}}}}}};
textareaContentChecker=function(C,B,A){var E=jQuery(C).caret().start;
var D=jQuery(C).caret().end;
C.value=C.value.substring(0,B);
jQuery(C).caret({start:E,end:D});
if(A){A.innerHTML=B-C.value.length
}};mtt.init=function(){document.fire("application:beforeInit");
if(jQuery("#map").length){mtt.poiHandler=new mtt.PoiHandler(jQuery("#map").get(0))
}$$(".defaultValue").each(function(C){new defaultValue(C)
});mtt.url.poiBase=mtt.url.resourcesImgBranded+"/pois/";
if(mtt.page){switch(mtt.page.type){case"advertisement":mtt.advertisement.init();
break;
case"advertview":mtt.advertview.init();
break;
case"newslettersubscription":mtt.newsletter.init();
break;
case"searchonmap":mtt.searchonmap=new mtt.SearchOnMap();
break;
case"search":mtt.launchAdsByRequest=true;
mtt.search.init();
mtt.messages.init();
break;
case"userdata":mtt.userdata.init();
break;
case"clickpage":mtt.clickpage.init();
break;
case"clickpageedit":mtt.clickpageedit.init();
break}}mtt.routeplanner.init();
mtt.addresssearch.init();
mtt.Login.init();
mtt.searchForm.init();
mtt.changeBackURL();
mtt.changeLinks();
mtt.disablePassReminders();
mtt.AutoImageResizer.findAndResize();
mtt.tabber.init();
mtt.defaultPlaces.init();
mtt.Logout.init();
mtt.noResult.init();
mtt.fixshareButtons();
mtt.registeredUsersOnlyWarn();
document.fire("application:afterInit");
mtt.fixIwiwLikes();
if(!mtt.launchAdsByRequest){document.fire("application:launchAds")
}if($("favorites")){if($("favorites").hasClassName("leftAlignedPopup")){$("favoriteList").addClassName("leftAlignedPopup")
}}mtt.favorites.init();
new mtt.MenuHinter("addToFavorites","addToFavoritesHint");
new mtt.MenuHinter("takeAdvert","takeAdvertHint");
new mtt.MenuHinter("profileMenu","profileMenuHint");
new mtt.MenuHinter("myAds","myAdsHint");
new mtt.MenuHinter("userProfile","userProfileMenu");
new mtt.MenuHinter("adverts","advertsMenu");
for(var B=0;
B<9;B++){var A=$("topCategoryD_"+B);
if(A&&A.down("li")){new mtt.MenuHinter("topCategoryL_"+B,"topCategoryD_"+B)
}}};mtt.showMessage=function(D,C){var B="customwin";
switch(mtt.site){case"business":B+=" businessMsgDialogSkin";
break;
case"phonebook":B+=" phoneBookMsgDialogSkin";
break;
default:case"yellowpages":B+=" yellowPagesMsgDialogSkin";
break}if(!C){C="error"
}if(typeof D=="string"){D=[{content:D}]
}if(mtt.errorMsgObj){var A=$("errorwin_messages").innerHTML;
A+="<p>"+D.pluck("content")+"</p>";
$("errorwin_messages").innerHTML=A
}else{mtt.errorMsgObj=new CustomW.Window({className:B,width:300,height:170,cornerWidth:14,cornerHeight:14,buttons:{ok_button:mtt.lang.close},zIndex:100,buttons:[{id:"okButton",label:"OK",className:"hu_ok",onClick:function(E){mtt.errorMsgObj.close();
delete mtt.errorMsgObj
}.bind(this)}],destroyOnClose:true,recenterAuto:true,onShow:function(){setTimeout(function(){var E=$(mtt.errorMsgObj.getId()+"_okButton");
if(E){E.focus();
setTabStop(E)
}}.bind(this),300)
}.bind(this),onClose:function(){delete mtt.errorMsgObj
}.bind(this),showModal:true});
mtt.errorMsgObj.setHTMLContent("<div id='errorwin_messages'><p>"+D.pluck("content")+"</p></div>");
mtt.errorMsgObj.show()
}};mtt.Login={init:function(){var C=$("loginForm");
if(C){}var A=$("loginName");
var B=$("loginPassword");
if(A&&B){A.observe("focus",mtt.Login.purifyInput.bind(this,A,mtt.lang.defaultEmail));
B.observe("focus",mtt.Login.purifyInput.bind(this,B,mtt.lang.defaultPassword));
A.observe("blur",mtt.Login.decorateInput.bind(this,A,mtt.lang.defaultEmail));
B.observe("blur",mtt.Login.decorateInput.bind(this,B,mtt.lang.defaultPassword));
mtt.Login.decorateInput(A,mtt.lang.defaultEmail);
mtt.Login.decorateInput(B,mtt.lang.defaultPassword)
}},purifyInput:function(A,B){if(A.value==B){A.value=""
}A.removeClassName("default")
},decorateInput:function(A,B){if(A.value==""){A.value=B;
A.addClassName("default")
}},post:function(A){new mtt.Ajax.Request(mtt.url.login,{parameters:{email:$("loginName").value,password:$("loginPassword").value,method:"Embedlogin",backURL:$("backURL").value},onComplete:mtt.Login.processJSON});
A.stop()
},processJSON:function(A,B,C){console.log(A,B,C);
console.log("login")
}};mtt.infoBar={init:function(){},show:function(A,B){if(!mtt.infoBar._infobar){mtt.infoBar._infobar=$("infoBar");
mtt.infoBar._infobar.down("a.close").observe("click",mtt.infoBar.hide);
mtt.infoBar._infobarContents=mtt.infoBar._infobar.down("span")
}if(B=="error"){mtt.infoBar._infobar.addClassName("infoBarError");
mtt.infoBar._infobar.removeClassName("infoBarWarning")
}else{if(B=="warning"){mtt.infoBar._infobar.addClassName("infoBarWarning");
mtt.infoBar._infobar.removeClassName("infoBarError")
}else{mtt.infoBar._infobar.removeClassName("infoBarWarning");
mtt.infoBar._infobar.removeClassName("infoBarError")
}}mtt.infoBar._infobarContents.update(A);
mtt.infoBar._infobar.style.display="block"
},hide:function(){if(mtt.infoBar._infobar){mtt.infoBar._infobar.style.display="none"
}}};mtt.addHashChangeListener=function(A){mtt._previousHash=window.location.hash;
if(!mtt._pollHash){mtt._pollHash=window.setInterval(function(){if(window.location.hash!=mtt._previousHash){mtt._previousHash=window.location.hash;
document.fire("mtt:hashchanged")
}},1000)
}document.observe("mtt:hashchanged",A)
};mtt.searchForm={init:function(){var C=$("routePlannerHint");
C&&C.observe("click",function(){C.remove()
}.bind(this));
mtt.searchForm.initWhereAutoCompleter();
mtt.searchForm._tabContent=$("tabContent");
mtt.searchForm._form=$("serviceSearchForm");
if(!(mtt.searchForm._form&&$("extendedSearchLink")&&$("simpleSearchLink"))){return 
}$("extendedSearchLink").observe("click",mtt.searchForm.extended);
$("simpleSearchLink").observe("click",mtt.searchForm.simple);
if($("extendedSearchLinkPerson")){$("extendedSearchLinkPerson").observe("click",mtt.searchForm.extended);
$("simpleSearchLinkPerson").observe("click",mtt.searchForm.simple)
}if($("textSearchLink")){$("textSearchLink").observe("click",mtt.searchForm.textSearch);
$("mapSearchLink").observe("click",mtt.searchForm.mapSearch)
}if($("textSearchLinkPerson")){$("textSearchLinkPerson").observe("click",mtt.searchForm.textSearch);
$("mapSearchLinkPerson").observe("click",mtt.searchForm.mapSearch)
}if($("searchPresentation").value=="text"){$("textSearchLink").addClassName("selected");
$("textSearchLinkPerson").addClassName("selected")
}else{if($("searchPresentation").value=="map"){$("mapSearchLink").addClassName("selected");
$("mapSearchLinkPerson").addClassName("selected")
}}if($("searchFormFilter")){var B=$("searchFormFilter");
var A=$("searchFormFilterText");
A.update;
A.observe("mouseover",mtt.searchForm.showFilters.bind(this,B,A));
A.observe("mouseout",mtt.searchForm.hideFilters.bind(this,B,A));
B.observe("mouseover",mtt.searchForm.showFilters.bind(this,B,A));
B.observe("mouseout",mtt.searchForm.hideFilters.bind(this,B,A));
B.observe("click",mtt.searchForm.selectFilters.bind(this,B,A))
}mtt.addHashChangeListener(mtt.searchForm._onHashChange);
mtt.searchForm._searchMode="text";
Event.observe($("serviceSearchForm"),"submit",function(D){if(mtt.lang.defaultWhere!=mtt.lang.defaultdefaultWhere){if($("where")){$("where").removeClassName("showDefaultValue")
}if($("whoWhere")){$("whoWhere").removeClassName("showDefaultValue")
}}$$("#tabContentContainer input").each(function(E){if(E.hasClassName("showDefaultValue")){if(E.getAttribute("rel").escapeHTML()==E.value){console.log(E.getAttribute("rel").escapeHTML());
E.value=""
}}})})
},initWhereAutoCompleter:function(){new mtt.GeoCompleter({element:jQuery("#where"),onAddressSelected:jQuery.proxy(mtt.searchForm.onAddressSelected,this,jQuery("#where")),onBeforeSearch:jQuery.proxy(mtt.searchForm.onBeforeSearch,this,jQuery("#where"))});
new mtt.GeoCompleter({element:jQuery("#whoWhere"),onAddressSelected:jQuery.proxy(mtt.searchForm.onAddressSelected,this,jQuery("#whoWhere")),onBeforeSearch:jQuery.proxy(mtt.searchForm.onBeforeSearch,this,jQuery("#whoWhere"))})
},onBeforeSearch:function(B){var A=B.parent("fieldset");
A.find("input[name=lat]").val("");
A.find("input[name=lon]").val("");
A.find("input[name=LLx]").val("");
A.find("input[name=LLy]").val("");
A.find("input[name=URx]").val("");
A.find("input[name=URy]").val("")
},onAddressSelected:function(B,C){var A=B.parent("fieldset");
A.find("input[name=lat]").val(C.lat);
A.find("input[name=lon]").val(C.lng);
try{A.find("input[name=LLx]").val(C.bbox.corner1.lng);
A.find("input[name=LLy]").val(C.bbox.corner1.lat);
A.find("input[name=URx]").val(C.bbox.corner2.lng);
A.find("input[name=URy]").val(C.bbox.corner2.lat)
}catch(D){A.find("input[name=LLx]").val(0);
A.find("input[name=LLy]").val(0);
A.find("input[name=URx]").val(0);
A.find("input[name=URy]").val(0)
}},showFilters:function(B,A,C){C.stop();
B.show()
},hideFilters:function(B,A,C){C.stop();
B.hide()
},selectFilters:function(B,A,C){C.stop();
B.hide();
$("searchResultsFilterTK").value=C.element().id;
A.update(C.element().innerHTML)
},_onHashChange:function(){},extended:function(B){if(B){B.stop()
}$("extendedSearchLink").addClassName("selected");
$("simpleSearchLink").removeClassName("selected");
$("extendedSearchLinkPerson").addClassName("selected");
$("simpleSearchLinkPerson").removeClassName("selected");
mtt.searchForm._tabContent.removeClassName("simple");
mtt.searchForm._tabContent.addClassName("extended");
mtt.searchForm._form.getElements().findAll(mtt.searchForm._isExtendedElement).invoke("enable");
$("detailedSearchForms").show();
$("where").disabled=true;
if($("where").value==""){$("where").value=mtt.lang.defaultWhere
}if(mtt.lang.defaultWhere!=mtt.lang.defaultdefaultWhere){$("where").removeClassName("showDefaultValue")
}$("searchType").value="extendedSearch";
var A=$("mainMenu");
if(A){$("mainMenu").setStyle("position:static")
}$$("#detailedSearchForms input").invoke("enable");
$$("#detailedSearchForms select").invoke("enable");
$("district").disabled=true;
Event.observe("city","keyup",mtt.searchForm.watchDistricts);
mtt.searchForm.watchDistricts()
},simple:function(B){if(B){B.stop()
}$("simpleSearchLink").addClassName("selected");
$("extendedSearchLink").removeClassName("selected");
$("simpleSearchLinkPerson").addClassName("selected");
$("extendedSearchLinkPerson").removeClassName("selected");
mtt.searchForm._tabContent.removeClassName("extended");
mtt.searchForm._tabContent.addClassName("simple");
mtt.searchForm._form.getElements().findAll(mtt.searchForm._isExtendedElement).invoke("disable");
$("detailedSearchForms").hide();
if($("where").value==""){$("where").value=mtt.lang.defaultWhere
}if(mtt.lang.defaultWhere!=mtt.lang.defaultdefaultWhere){$("where").removeClassName("showDefaultValue")
}$("searchType").value="simpleSearch";
var A=$("mainMenu");
if(A){$("mainMenu").setStyle("position:static")
}$$("#detailedSearchForms input").invoke("disable");
$$("#detailedSearchForms select").invoke("enable");
$("where").enable()
},mapSearch:function(A){if(A){A.stop()
}$("textSearchLink").removeClassName("selected");
$("mapSearchLink").addClassName("selected");
$("textSearchLinkPerson").removeClassName("selected");
$("mapSearchLinkPerson").addClassName("selected");
$("searchPresentation").value="mapSearch";
$("serviceSearchForm").action=$$(".searchMode input")[1].value;
mtt.searchForm.searchMode="map"
},textSearch:function(A){if(A){A.stop()
}$("mapSearchLink").removeClassName("selected");
$("textSearchLink").addClassName("selected");
$("mapSearchLinkPerson").removeClassName("selected");
$("textSearchLinkPerson").addClassName("selected");
$("searchPresentation").value="textSearch";
$("serviceSearchForm").action=$$(".searchMode input")[0].value;
mtt.searchForm.searchMode="text"
},_isExtendedElement:function(A){return A.hasClassName("extended")
},watchDistricts:function(){input=$("city").value;
if(input.toLowerCase()=="budapest"){$("district").disabled=false
}else{$("district").disabled=true
}}};mtt.favorites={init:function(){this.favA=$("favorites");
this.favPopup=$("favoriteList");
if(!this.favA||!this.favA){return 
}this.favA.observe("mouseover",this.moreFavsShow.bind(this));
this.favPopup.observe("mouseover",this.moreFavsShow.bind(this));
this.favA.observe("mouseout",this.moreFavsHide.bind(this,this.favA));
this.favPopup.observe("mouseout",this.moreFavsHide.bind(this,this.favPopup));
return ;
this.callingCards=[];
if(mtt.favoritedAds){for(var B=0,A=mtt.favoritedAds.length;
B<A;B++){var C=mtt.favoritedAds[B];
mtt.favorites.attachCallingCard(C)
}}},attachCallingCard:function(D){var B=D[0];
var E=$("favorited_"+B);
var A=$("card_favorite_"+B);
document.body.appendChild(A.remove());
this.callingCards.push(A);
if(Prototype.Browser.IE){var C=new Element("IFRAME",{id:A.id+"_iefix",style:"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);z-index: 9",src:"javascript:false;",frameborder:"0",scrolling:"no"});
A.insert({after:C})
}if(E){E.observe("mouseover",mtt.favorites.showCallingCard.bind(this,D,B,E,A,C));
E.observe("mouseout",mtt.favorites.hideCallingCard.bind(this,D,B,E,A,C,E))
}if(A){A.observe("mouseover",mtt.favorites.showCallingCard.bind(this,D,B,E,A,C));
A.observe("mouseout",mtt.favorites.hideCallingCard.bind(this,D,B,E,A,C,A))
}},showCallingCard:function(E,C,F,A,D,G){A.hide();
var B=[F.cumulativeOffset()[0]-100,F.cumulativeOffset()[1]+16];
if(E[1]=="onPopup"){mtt.favorites.moreFavsShow();
B[1]-=$("moreFavoritesUL").scrollTop;
if(B[0]==-100){return 
}}A.setStyle({left:B[0]+"px",top:B[1]+"px"});
D&&D.setStyle({left:B[0]+parseInt(A.getStyle("margin-left"))+"px",top:B[1]+"px",width:A.getWidth()+"px",height:A.getHeight()+"px"});
A.show();
D&&D.show();
this.moreFavsShow()
},hideCallingCard:function(E,B,F,A,C,D,G){if(!isRealMouseEventTarget(G,D)){return 
}A.hide();
C&&C.hide();
mtt.favorites.moreFavsShow()
},hideAllCallingCards:function(){this.callingCards.invoke("hide")
},moreFavsShow:function(){var A=this.favA.cumulativeOffset();
this.favPopup.setStyle({left:A[0]-4+"px",top:A[1]+this.favA.getHeight()+"px"});
this.favA.addClassName("hover");
mtt.favorites.favPopup.show()
},moreFavsHide:function(A,B){if(!isRealMouseEventTarget(B,A)){return 
}mtt.favorites.favPopup.hide();
this.favA.removeClassName("hover")
}};mtt.MenuHinter=Class.create({initialize:function(B,C,A){this.elem=$(B);
this.hint=$(C);
if(!this.elem||!this.hint){return 
}this.options=Object.clone(A);
this.options.hideDelay=this.options.hideDelay||100;
document.body.appendChild(this.hint.remove());
this.elem.observe("mouseover",this.showHint.bind(this));
this.elem.observe("mouseout",this.hideHint.bind(this));
this.hint.observe("mouseover",this.showHint.bind(this));
this.hint.observe("mouseout",this.hideHint.bind(this))
},showHint:function(){if(this.hidingTimer){clearTimeout(this.hidingTimer);
delete this.hidingTimer
}var A=this.elem.cumulativeOffset();
this.hint.setStyle({left:A[0]-4+"px",top:A[1]+this.elem.getHeight()+"px"});
this.elem.addClassName("hover");
this.hint.show()
},hideHint:function(){this.hidingTimer=setTimeout(function(){this.elem.removeClassName("hover");
this.hint.hide();
delete this.hidingTimer
}.bind(this),this.options.hideDelay)
}});mtt.bookmarkIt=function(){if(document.all){window.external.AddFavorite(document.location.href,document.title)
}else{if(window.sidebar){window.sidebar.addPanel(document.title,document.location.href,"")
}}return false
};mtt.changeBackURL=function(){if($("backURL")){$("backURL").value=document.location
}};mtt.changeLinks=function(){$$("a").each(function(A){if(A.rel=="blank"){A.setAttribute("target","_blank")
}})};mtt.disablePassReminders=function(){$$(".disablePassReminder").each(function(A){A.setAttribute("autocomplete","off")
})};mtt.CookieManager={createCookie:function(C,D,E){if(E){var B=new Date();
B.setTime(B.getTime()+(E*24*60*60*1000));
var A="; expires="+B.toGMTString()
}else{var A=""
}document.cookie=C+"="+D+A+"; path=/"
},readCookie:function(B){var D=B+"=";
var A=document.cookie.split(";");
for(var C=0;
C<A.length;
C++){var E=A[C];
while(E.charAt(0)==" "){E=E.substring(1,E.length)
}if(E.indexOf(D)==0){return E.substring(D.length,E.length)
}}return null
},eraseCookie:function(A){createCookie(A,"",-1)
}};mtt.AutoImageResizer={findAndResize:function(){$$(".imgMaxSize").each(function(C){if(!C.hasClassName("fixed")){var B=C.classNames().grep("maxWidth");
B=(B[0])?parseInt(B[0].substring(8)):null;
var A=C.classNames().grep("maxHeight");
A=(A[0])?parseInt(A[0].substring(9)):null;
if(B||A){mtt.AutoImageResizer.resizeTo(B,A,C)
}C.addClassName("fixed")
}})},resizeTo:function(C,B,A){var E=A.width;
var D=A.height;
if(E>C){A.setAttribute("width",C);
A.setAttribute("height",Math.round(C*(D/E)))
}if(D>B){A.setAttribute("height",B);
A.setAttribute("width",Math.round(B*(E/D)))
}}};mtt.tabber={init:function(){$$("."+navTabClass+" li").each(function(A){A.observe("click",showTabEvent)
});if($(defaultTabId)==null){if($$("."+navTabClass).first().firstDescendant()){showTab($$("."+navTabClass).first().firstDescendant())
}}else{showTab($(defaultTabId))
}if($("mainMenu")){$("mainMenu").setStyle("position:static")
}}};mtt.defaultPlaces={init:function(){select=$("place");
Event.observe(select,"change",function(){this.up("form").submit()
})}};mtt.Logout={init:function(){this.el=$("logoutButton");
if(this.el){Event.observe(this.el,"click",function(){this.el.up("form").submit()
}.bind(this))
}}};mtt.noResult={init:function(){if($$(".noResults")[0]){$$(".noResults .relatedLocations li a").each(function(A){Event.observe(A,"click",function(B){Event.stop(B);
if($("whoWhere")){$("whoWhere").value=A.innerHTML
}if($("where")){$("where").value=A.innerHTML
}$("serviceSearchForm").submit()
})});if($$(".searchInArea")[0]){Event.observe($("areaRadius"),"change",function(){var A=document.createElement("input");
A.setAttribute("name","areaRadius");
A.setAttribute("type","hidden");
A.value=this.value;
$("serviceSearchForm").appendChild(A);
$("serviceSearchForm").submit()
})}}}};
mtt.fixshareButtons=function(){var A=encodeURIComponent(document.location);
var B=encodeURIComponent(document.title);
jQuery("ul.shareResults li").each(function(E,C){C=jQuery(C);
var D=C.find("a");
switch(C.get(0).className){case"facebook":D.attr("href","http://www.facebook.com/sharer.php?u="+A+"&t="+B);
break;
case"iwiw":D.attr("href","http://iwiw.hu/pages/share/share.jsp?u="+A+"&t="+B);
break;
case"twitter":break
}});jQuery("ul.shareResults .twitter a").click(function(){jQuery(".twitterShareUrlShortener").remove();
var C=jQuery('<script src="http://go2.gs/api/shorten?url='+A+'&callback=urlShortenerForTwitterCallback&format=json" class="twitterShareUrlShortener"><\/script>');
jQuery("html head").append(C);
return false
})};window.urlShortenerForTwitterCallback=function(A){window.location="http://twitter.com/home?status="+encodeURIComponent(A.url+" - "+document.title)
};mtt.registeredUsersOnlyWarn=function(){jQuery(".registeredUsersOnly").click(function(A){if(jQuery(A.currentTarget).parent("li").attr("id")=="addNewServiceBtn"){mtt.showMessage(mtt.lang.plsLoginNewAdvert)
}else{mtt.showMessage(mtt.lang.plsLogin)
}jQuery("#errorwin_messages").parent().append(jQuery('<button type="button" onclick="window.location=\''+mtt.url.registration+"';\">"+mtt.lang.registration+"</button>"));
return false
})};mtt.fixIwiwLikes=function(){jQuery.each(jQuery(".iwiwLikePlaceHolder"),function(B,C){C=jQuery(C);
if(C.hasClass("fixed")){return 
}var A=C.parents(".margined").find("h3 a");
var E=A.html();
var D=A.attr("href");
C.html('<iframe src="http://iwiw.hu/like.jsp?u='+encodeURIComponent("http://"+document.domain+D)+"&title="+encodeURIComponent(E)+'&t=ajanlom&s=white" width="110px" height="21px" style="border: none" scrolling="no" frameBorder="0"></iframe>');
C.addClass("fixed")
})};document.observe("dom:fixed",mtt.AutoImageResizer.findAndResize);
document.observe("dom:loaded",mtt.init);
jQuery(window).load(function(){window.documentLoaded=true
});mtt.GeoCompleter=JClass.extend({options:null,googleDefaultOpts:{address:"%ADDRESS%"+mtt.googleGeoCodingPostStr,region:"hu",language:"hu"},mttDefaultOpts:{autoCompleteName:"where",prefix:"%ADDRESS%"},init:function(A){this.options={};
jQuery.extend(this.options,A);
this.geocoder=new google.maps.Geocoder();
if(this.options.element&&this.options.element.length>0){this.createAutocompleter()
}},createAutocompleter:function(){this.options.element.autocomplete({source:jQuery.proxy(function(B,A){this.call("onBeforeSearch");
var C=this.options.element.val();
if(/[0-9,." "\t]/g.test(C)){this._googleGeoCoding(B,A)
}else{this._mttGeoCoding(B,A)
}},this),select:jQuery.proxy(this.onAddressSelected,this)});
this.options.element.blur(jQuery.proxy(function(B){if(jQuery(".ui-autocomplete li:visible").length>0){var A=jQuery(jQuery(".ui-autocomplete li:visible:first").data()).attr("item.autocomplete")
}setTimeout(jQuery.proxy(function(){var D=this.options.element.data("autocomplete").selectedItem;
if(D){console.log("onblur: kiválasztott item",A,D,D.lat,D.lng)
}else{console.log("onblur: bezáródott autocomplete")
}var C=null;
if(D){C=D
}else{if(A!=null){C=A
}}if(C){this.onAddressSelected(B,{item:C})
}},this),200)
},this))
},_googleGeoCoding:function(B,C){var A={};
jQuery.extend(A,this.googleDefaultOpts);
A.address=A.address.replace("%ADDRESS%",this.options.element.val());
this.geocoder.geocode(A,function(F,D){if(D==google.maps.GeocoderStatus.OK){var E=[];
F.each(function(G){E.push(mtt.googleResultToUni(G))
});C(E)
}})},_mttGeoCoding:function(B,C){var A={};
jQuery.extend(A,this.mttDefaultOpts);
A.prefix=A.prefix.replace("%ADDRESS%",this.options.element.val());
new mtt.Ajax.Request(mtt.url.geocoding,{method:"get",parameters:A,onComplete:function(E,F,G){var D=[];
jQuery.each(jQuery(E.responseText).find("li"),function(I,H){if(I>=10){return 
}var J=jQuery.parseJSON(jQuery(H).html());
D.push(mtt.mttResultToUni(J))
});C(D)
}})},normalizeGoogleResults:function(A){var C=[];
var B=[];
jQuery.each(A,function(E,D){var F=D.formatted_address+"|"+D.geometry.location.lat()+"|"+D.geometry.location.lng();
if(B.indexOf(F)==-1){C.push(D);
B.push(F)
}});return C
},searchAddress:function(C,D,A){this.call("onBeforeSearch");
var B={};
jQuery.extend(B,this.googleDefaultOpts);
B.address=B.address.replace("%ADDRESS%",C);
this.geocoder.geocode(B,jQuery.proxy(function(F,E){if(E==google.maps.GeocoderStatus.OK){if(D){if(F.length==0){this.handleZeroResultsError()
}else{F=this.normalizeGoogleResults(F);
if(F.length>1){this.handleTooManyResultsError(mtt.googleResultsToUnis(F))
}}}if(F.length==1){A(mtt.googleResultToUni(F[0]))
}}else{if(E==google.maps.GeocoderStatus.ZERO_RESULTS&&D){this.handleZeroResultsError()
}}},this))
},handleZeroResultsError:function(){mtt.showMessage(mtt.lang.addressNotFound)
},handleTooManyResultsError:function(B){mtt.showMessage(mtt.lang.tooManyAddressHits+'<ul class="tooManyResults"></ul>');
var A=this;
jQuery.each(B,function(E,D){var C=jQuery('<li><a href="#">'+D.label+"</a></li>");
C.find("a").data({geoCompleter:A,item:D});
jQuery("#errorwin_messages .tooManyResults").append(C);
mtt.errorMsgObj.setSize(400,jQuery("#errorwin_messages .tooManyResults").height()+150)
})},onAddressSelectFromTooManyResultsList:function(A){mtt.errorMsgObj.close();
delete mtt.errorMsgObj;
this.onAddressSelected({},{item:A.data("item")})
},onAddressSelected:function(B,A){console.log("onAddressSelected",A.item,A.item.label,A.item.lat,A.item.lng);
this.options.element.val(A.item.label);
this.call("onAddressSelected",A.item)
},call:function(C){var A=[];
for(var B=1;
B<arguments.length;
B++){A.push(arguments[B])
}if(typeof this.options[C]=="function"){this.options[C].apply(null,A)
}}});jQuery("#errorwin_messages .tooManyResults a").live("click",function(){jQuery(this).data("geoCompleter").onAddressSelectFromTooManyResultsList(jQuery(this))
});mtt.googleResultsToUnis=function(A){for(var B=0;
B<A.length;
B++){A[B]=mtt.googleResultToUni(A[B])
}return A
};mtt.googleResultToUni=function(B){var A={label:B.formatted_address,lat:B.geometry.location.lat(),lng:B.geometry.location.lng()};
if(B.geometry.bounds){A.bbox={corner1:{lat:B.geometry.bounds.getNorthEast().lat(),lng:B.geometry.bounds.getNorthEast().lng()},corner2:{lat:B.geometry.bounds.getSouthWest().lat(),lng:B.geometry.bounds.getSouthWest().lng()},center:{lat:B.geometry.bounds.getSouthWest().lat(),lng:B.geometry.bounds.getSouthWest().lng()}}
}return A
};mtt.mttResultToUni=function(B){var C=Math.min(B.lly,B.ury)+((Math.max(B.lly,B.ury)-Math.min(B.lly,B.ury))/2);
var A=Math.min(B.llx,B.urx)+((Math.max(B.llx,B.urx)-Math.min(B.llx,B.urx))/2);
return{label:B.name,lat:C,lng:A,bbox:{corner1:{lat:B.lly,lng:B.llx},corner2:{lat:B.ury,lng:B.urx},center:{lat:C,lng:A}}}
};mtt.Ajax={};
mtt.Ajax.Request=Class.create(PAjax.Request,{initialize:function(C,B){this.transport=PAjax.getTransport();
this.options=Object.clone(B);
var F=this.options.onComplete||Prototype.emptyFunction;
var E=this.options.onError||Prototype.emptyFunction;
var D=this.options.onFailure||Prototype.emptyFunction;
var A=this.options.onException||Prototype.emptyFunction;
this.options.onComplete=(function(M,J){var L=$H({});
L.result={};
L.messages=$A();
if(M.responseXML&&M.responseXML.firstChild){if(isBrowser.ie){xmlDoc=M.responseXML.documentElement
}else{xmlDoc=Element.cleanWhitespace(M.responseXML.documentElement)
}var K=xmlDoc.firstChild;
while(K){if(K.nodeName=="content"){L.result.content=K;
if(isBrowser.ie){L.result.contentAsText=L.result.content.text
}else{L.result.contentAsText=L.result.content.textContent
}}else{if(K.nodeName=="contentMain"){L.result.contentMain=K;
if(isBrowser.ie){L.result.contentMainAsText=L.result.content.text
}else{L.result.contentMainAsText=L.result.content.textContent
}}else{if(K.nodeName=="status"){var G=K.firstChild;
while(G){if(G.nodeName=="msg"){var I=$A();
I.type=G.getAttribute("type");
I.code=G.getAttribute("code");
I.content="";
var H=G.firstChild;
while(H){I.content+=H.nodeValue;
H=H.nextsibling
}L.messages.push(I);
if(I.type=="ERROR"){L.hasError=true
}}G=G.nextSibling
}}}}K=K.nextSibling
}}if(L.hasError){mtt.showMessage(L.messages);
E(M,J,L)
}else{F(M,J,L)
}}).bind(this);
this.options.onFailure=(function(H,G){mtt.showMessage(mtt.lang.ajaxRequestFailed);
D(H,G);
this.errorShown=true
}).bind(this);
this.options.onException=(function(H,G){console.log("mtt.Ajax.onException",G);
console.group();
console.log("requested url: "+H.url);
console.log("exception location: "+G.fileName+":"+G.lineNumber);
console.log("exception description: ["+G.name+"] - "+G.message);
console.log(G.stack);
console.groupEnd();
if(!this.errorShown){mtt.showMessage(mtt.lang.ajaxRequestFailed)
}A(H,G)
}).bind(this);
this.request(C)
}});mtt.ImageUpload=Class.create({initialize:function(B,C){this.container=$(B);
this.id=this.container.id;
this._options=C;
this._errorContainer=this.container.down(".errorMessage");
this._errorButton=this.container.down(".errorState button");
this._fileInput=this.container.down("input[type=file]");
Element.observe(this.container.down("button[name=delete]"),"click",(this._deleteHandler=this._delete.bind(this)));
Element.observe(this._fileInput,"change",(this._saveHandler=this._save.bind(this)));
this._imgLink=this.container.down(".viewState .imgContainer a");
this._img=this.container.down(".viewState .imgContainer img");
if(this._img){this._imgLink.observe("click",this._viewImage.bind(this));
this._setStatus("view");
this.uploaded=true;
var A=this.container.down(".viewState .imgContainer");
this._copyClasses(A,this._img);
document.fire("dom:fixed")
}else{this._setStatus("upload");
this.uploaded=false
}if(!mtt.ImageUpload.instances){mtt.ImageUpload.instances=$A()
}mtt.ImageUpload.instances.push(this)
},onChange:Prototype.emptyFunction,onSave:Prototype.emptyFunction,onDelete:Prototype.emptyFunction,_setStatus:function(A,C,B){this.container.removeClassName("defaultState");
this.container.removeClassName("uploadState");
this.container.removeClassName("busyUploadState");
this.container.removeClassName("busyDeleteState");
this.container.removeClassName("viewState");
this.container.removeClassName("errorState");
if(A=="error"){this._errorContainer.update(C);
this._errorButton.stopObserving("click",this._nextState);
if(B=="upload"){this._nextState=this._setStatus.bind(this,"upload");
this._errorButton.observe("click",this._nextState)
}else{if(B=="view"){this._nextState=this._setStatus.bind(this,"view");
this._errorButton.observe("click",this._nextState)
}}}this.container.addClassName(A+"State")
},_save:function(){this._setStatus("busyUpload");
this.onSave(this);
this._initIframe();
if(mtt.ImageUpload._uploadForm){while(mtt.ImageUpload._uploadForm.firstChild){mtt.ImageUpload._uploadForm.removeChild(mtt.ImageUpload._uploadForm.firstChild)
}}if(this._options.upload.parameters){for(var D in this._options.upload.parameters){var A=document.createElement("input");
A.setAttribute("type",this._options.debug?"text":"hidden");
A.setAttribute("name",D);
A.setAttribute("value",this._options.upload.parameters[D]);
this._form().appendChild(A)
}}var C=this._fileInput.parentNode;
var B=this._fileInput.nextSibling;
var E=this._fileInput.cloneNode(true);
this._form().appendChild(this._fileInput.remove());
this._fileInput=C.insertBefore(E,B);
Element.observe(this._fileInput,"change",(this._saveHandler=this._save.bind(this)));
this._form().setAttribute("target","uploadFrame"+this.id);
this._form().setAttribute("action",this._options.upload.action);
this._form().submit()
},_onload:function(){var A=this._uploadFrame.contentWindow.response;
if(A){if(A.errorCode==0){this._processResponse(A)
}else{this._setStatus("error",A.errorText,"upload")
}}else{this._setStatus("error",this._options.upload.defaultError,"upload")
}},_processResponse:function(B){if(!this._img){var A=this.container.down(".viewState .imgContainer");
this._imgLink=document.createElement("a");
Event.observe(this._imgLink,"click",this._viewImage.bind(this));
this._img=document.createElement("img");
A.appendChild(this._imgLink).appendChild(this._img);
this._copyClasses(A,this._img)
}this._img.src=B.thumbnail;
this._imgLink.href=B.image;
this._img.removeClassName("fixed");
this._setStatus("view");
this._changeUploaded(true)
},_copyClasses:function(A,B){A.classNames().each(function(C){if(C!="imgContainer"){if(C=="paramImgMaxSize"){B.addClassName("imgMaxSize")
}else{B.addClassName(C)
}}}.bind(this))
},_delete:function(){this._setStatus("busyDelete");
new mtt.Ajax.Request(this._options.del.action,{method:"get",parameters:this._options.del.parameters,onComplete:this._ondelete.bind(this),onError:this._ondeleteError.bind(this)})
},_ondelete:function(){this._changeUploaded(false);
console.log("FIXME: ondelete");
this.onDelete();
this._fileInput.value="";
this._setStatus("upload")
},_ondeleteError:function(){this._setStatus("error",this._options.upload.defaultError,"delete")
},_changeUploaded:function(A){this.uploaded=A;
this.onChange(this)
},_viewImage:function(A){A.stop();
if(!this._imageView){this._imageView=new mtt.ImageView(this._imgLink)
}this._imageView.show()
},_form:function(){if(!mtt.ImageUpload._uploadForm){var A=document.createElement("form");
A.setAttribute("method","post");
A.setAttribute("enctype","multipart/form-data");
A.setAttribute("encoding","multipart/form-data");
if(this._options.debug){console.log("debug");
A.setAttribute("style","border:1px solid red")
}else{A.style.display="none"
}document.body.appendChild(A);
mtt.ImageUpload._uploadForm=A
}return mtt.ImageUpload._uploadForm
},_initIframe:function(){if(!this._uploadFrame){var A=document.createElement("iframe");
A.setAttribute("id","uploadFrame"+this.id);
A.setAttribute("name","uploadFrame"+this.id);
if(this._options.debug){A.setAttribute("width","600");
A.setAttribute("height","100")
}else{A.style.display="none"
}document.body.appendChild(A);
window.frames["uploadFrame"+this.id].name="uploadFrame"+this.id;
this._uploadFrame=A
}Event.observe(this._uploadFrame,"load",(this._onLoadHandler=this._onload.bind(this)))
}});mtt.ManagedImageUpload=Class.create(mtt.ImageUpload,{destroy:function(){if(this._uploadFrame){Element.remove(this._uploadFrame)
}Element.remove(this.container);
mtt.ImageUploadManager.instances.get(this._options.manager).remove(this)
},_processResponse:function($super,A){$super(A);
this._options.imageId=A.id
},_delete:function($super){if(!this._options.del.parameters){this._options.del.parameters={}
}this._options.del.parameters.imageId=this._options.imageId;
$super()
},_ondelete:function($super){this.onDelete();
this.destroy()
}});mtt.ImageUploadManager=Class.create({initialize:function(A,B){this._options=B;
this.container=$(A);
mtt.ImageUploadManager.instances.set(this.container.id,this);
this._imageUploads=$A();
this.container.getElementsByClassName("imageUpload").each(function(C){if(C.id==(this.container.id+"prototype")){this._prototype=C.remove()
}else{this.add(this._createImageUpload(C))
}},this)
},add:function(A){A.onSave=this._onSave.bind(this);
this._imageUploads.push(A)
},remove:function(A){this._imageUploads=this._imageUploads.without(A)
},size:function(){return this._imageUploads.size()
},_createImageUpload:function(C){var B=Object.clone(this._options.commonOptions);
var A=C.down("input[name=imageId]");
if(A){B.imageId=A.value
}B.manager=this.container.id;
C.id=mtt.ImageUploadManager.generateId();
return new mtt.ManagedImageUpload(C,B)
},_onSave:function(){this.container.removeClassName("uploadState");
if((!this._options.max||this._imageUploads.size()<this._options.max)&&this._imageUploads.last()&&!this._imageUploads.last().container.hasClassName("uploadState")){this.add(this._createImageUpload(this.container.appendChild(this._prototype.cloneNode(true))))
}}});Object.extend(mtt.ImageUploadManager,{instances:$H(),generateId:function(){if(!mtt.ImageUploadManager._lastId){mtt.ImageUploadManager._lastId=0;
mtt.ImageUploadManager.instances.values().each(function(A){mtt.ImageUploadManager._lastId+=A.size()
})}else{mtt.ImageUploadManager._lastId++
}return"newManagedImageUpload"+mtt.ImageUploadManager._lastId
}});mtt.ImageView=Class.create({initialize:function(B,A){console.log("sdg",B);
this.element=B;
this._options=Object.clone(A);
this._options.popupSkin=this._popupSkins[this._options.popupSkin];
if(!this._options.popupSkin){this._options.popupSkin=this._popupSkins.simple
}this._options.popupPreloaderSkin=this._popupPreloaderSkins[this._options.popupPreloaderSkin];
if(!this._options.popupPreloaderSkin){this._options.popupPreloaderSkin=this._popupPreloaderSkins.simple
}},show:function(A){A&&A.stop&&A.stop();
this._createModalBG();
if(this.loaded){this._showPopup()
}else{this._createPopupPreloader();
this._centerDiv(this.popupPreloaderDiv);
this._createPopup()
}},_popupSkins:{simple:{before:'<div class="imageUploadPopupContent">',after:'<span class="caption"></div></div>'}},_popupPreloaderSkins:{simple:'<div class="imageUploadPreloaderContent">'+mtt.lang.loadingPicture+"</div>"},_createModalBG:function(){if(!this.modalBG){this.modalBG=new Element("div",{className:"imageUploadBg"});
document.body.appendChild(this.modalBG)
}this.modalBG.setOpacity(0.3);
this.modalBG.setStyle({width:document.body.getWidth()+"px",height:document.body.getHeight()+"px"})
},_createPopup:function(){if(!this.popupDiv){this.popupDiv=new Element("div",{className:"imageUploadPopup"}).update(this._options.popupSkin.before+'<img src="" class="image" />'+this._options.popupSkin.after);
this.popupDiv.hide();
document.body.appendChild(this.popupDiv);
this.popupIframe=new Element("iframe",{style:"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);",src:"javascript:false;",frameBorder:0,scrolling:"no"});
this.popupDiv.up().insert(this.popupIframe,{after:this.popupDiv});
this._img=this.popupDiv.down(".image");
this._img.observe("load",function(A){this._showPopup();
this.loaded=true;
this.popupDiv.observe("click",function(B){this.popupDiv.hide();
this.modalBG.hide();
this.popupIframe.hide();
$$("object[type=application/x-shockwave-flash]").each(function(C){C.setStyle({visibility:"visible"})
})}.bind(this))
}.bind(this));
this._img.setAttribute("src",this.element.href);
this._img.setAttribute("title",mtt.lang.clickToClose)
}},_createPopupPreloader:function(){if(!this.popupPreloaderDiv){this.popupPreloaderDiv=new Element("div",{className:"imageUploadPopupPreloader"}).update(this._options.popupPreloaderSkin);
document.body.appendChild(this.popupPreloaderDiv)
}},_centerDiv:function(C){var B=document.viewport.getScrollOffsets()[0]+(document.viewport.getWidth()-C.getWidth())/2;
var A=document.viewport.getScrollOffsets()[1]+(document.viewport.getHeight()-C.getHeight())/2;
B=(B<0)?20:B;
A=(A<0)?20:A;
C.setStyle({left:B+"px",top:A+"px"})
},_resizeTo:function(B,A){B-=60;
A-=60;
var D=this._img.width;
var C=this._img.height;
if(D>B){this._img.setAttribute("width",B);
this._img.setAttribute("height",Math.round(B*(C/D)))
}if(C>A){this._img.setAttribute("height",A);
this._img.setAttribute("width",Math.round(A*(D/C)))
}},_showPopup:function(){this._resizeTo(document.viewport.getWidth()-50,document.viewport.getHeight()-50);
this._centerDiv(this.popupDiv);
this.popupDiv.show();
if(this.popupPreloaderDiv){this.popupPreloaderDiv.remove();
delete this.popupPreloaderDiv
}if(this.popupIframe){setTimeout(function(){this.popupIframe.setStyle({width:this.popupDiv.getWidth()+"px",height:this.popupDiv.getHeight()+"px",left:this.popupDiv.positionedOffset()[0]+"px",top:this.popupDiv.positionedOffset()[1]+"px"});
this.popupIframe.show()
}.bind(this),50)
}this.modalBG.show();
this.popupIframe.show();
$$("object[type=application/x-shockwave-flash]").each(function(A){A.setStyle({visibility:"hidden"})
});if(isBrowser.ie7){this._resizeTo(document.viewport.getWidth()-50,document.viewport.getHeight()-50);
this._centerDiv(this.popupDiv)
}}});mtt.FileUpload=Class.create({initialize:function(A,B){this.container=$(A);
this.id=this.container.id;
this._options=B;
this._errorContainer=this.container.down(".errorMessage");
this._errorButton=this.container.down(".errorState button");
this._fileInput=this.container.down("input[type=file]");
Element.observe(this.container.down("button[name=delete]"),"click",(this._deleteHandler=this._delete.bind(this)));
Element.observe(this._fileInput,"change",(this._saveHandler=this._save.bind(this)));
this._fileURL=this.container.down(".viewState .fileContainer a");
this._fileName=this.container.down(".viewState .fileContainer span");
if(this._fileName){this._fileURL.observe("click",this._downloadFile.bind(this));
this._setStatus("view");
this.uploaded=true
}else{this._setStatus("upload");
this.uploaded=false
}if(!mtt.FileUpload.instances){mtt.FileUpload.instances=$A()
}mtt.FileUpload.instances.push(this)
},onChange:Prototype.emptyFunction,onSave:Prototype.emptyFunction,onDelete:Prototype.emptyFunction,_setStatus:function(A,C,B){this.container.removeClassName("defaultState");
this.container.removeClassName("uploadState");
this.container.removeClassName("busyUploadState");
this.container.removeClassName("busyDeleteState");
this.container.removeClassName("viewState");
this.container.removeClassName("errorState");
if(A=="error"){this._errorContainer.update(C);
this._errorButton.stopObserving("click",this._nextState);
if(B=="upload"){this._nextState=this._setStatus.bind(this,"upload");
this._errorButton.observe("click",this._nextState)
}else{if(B=="view"){this._nextState=this._setStatus.bind(this,"view");
this._errorButton.observe("click",this._nextState)
}}}this.container.addClassName(A+"State")
},_save:function(){this._setStatus("busyUpload");
this.onSave(this);
this._initIframe();
if(mtt.FileUpload._uploadForm){mtt.FileUpload._uploadForm.update()
}if(this._options.upload.parameters){for(var D in this._options.upload.parameters){var A=document.createElement("input");
A.setAttribute("type",this._options.debug?"text":"hidden");
A.setAttribute("name",D);
A.setAttribute("value",this._options.upload.parameters[D]);
this._form().appendChild(A)
}}var C=this._fileInput.parentNode;
var B=this._fileInput.nextSibling;
var E=this._fileInput.cloneNode(true);
this._form().appendChild(this._fileInput.remove());
this._fileInput=C.insertBefore(E,B);
Element.observe(this._fileInput,"change",(this._saveHandler=this._save.bind(this)));
this._form().setAttribute("target","uploadFrame"+this.id);
this._form().setAttribute("action",this._options.upload.action);
this._form().submit()
},_onload:function(){var A=this._uploadFrame.contentWindow.response;
if(A){if(A.errorCode==0){this._processResponse(A)
}else{this._setStatus("error",A.errorText,"upload")
}}else{this._setStatus("error",this._options.upload.defaultError,"upload")
}},_processResponse:function(B){if(!this._fileName){var A=this.container.down(".viewState .fileContainer");
this._fileURL=document.createElement("a");
this._fileURL.setAttribute("target","_blank");
Event.observe(this._fileURL,"click",this._downloadFile.bind(this));
this._fileName=document.createElement("span");
A.appendChild(this._fileURL).appendChild(this._fileName)
}console.log(B);
var D=B.size;
var C=B.file+" ("+D+")";
this._fileName.update(C);
this._fileURL.href=B.fileurl;
this._setStatus("view");
this._options.del.parameters.file_id=B.id;
this._changeUploaded(true)
},_delete:function(){this._setStatus("busyDelete");
new mtt.Ajax.Request(this._options.del.action,{method:"get",parameters:this._options.del.parameters,onComplete:this._ondelete.bind(this),onError:this._ondeleteError.bind(this)})
},_ondelete:function(){this._changeUploaded(false);
console.log("FIXME: ondelete");
this.onDelete();
this._fileInput.value="";
this._setStatus("upload")
},_ondeleteError:function(){this._setStatus("error",this._options.upload.defaultError,"upload")
},_changeUploaded:function(A){this.uploaded=A;
this.onChange(this)
},_downloadFile:function(A){},_form:function(){if(!mtt.FileUpload._uploadForm){var A=document.createElement("form");
A.setAttribute("method","post");
A.setAttribute("enctype","multipart/form-data");
A.setAttribute("encoding","multipart/form-data");
if(this._options.debug){console.log("debug");
A.setAttribute("style","border:1px solid red")
}else{A.style.display="none"
}document.body.appendChild(A);
mtt.FileUpload._uploadForm=A
}return mtt.FileUpload._uploadForm
},_initIframe:function(){if(!this._uploadFrame){var A=document.createElement("iframe");
A.setAttribute("id","uploadFrame"+this.id);
A.setAttribute("name","uploadFrame"+this.id);
if(this._options.debug){A.setAttribute("width","600");
A.setAttribute("height","100")
}else{A.style.display="none"
}document.body.appendChild(A);
window.frames["uploadFrame"+this.id].name="uploadFrame"+this.id;
this._uploadFrame=A
}Event.observe(this._uploadFrame,"load",(this._onLoadHandler=this._onload.bind(this)))
}});mtt.ManagedFileUpload=Class.create(mtt.FileUpload,{destroy:function(){if(this._uploadFrame){Element.remove(this._uploadFrame)
}Element.remove(this.container);
mtt.FileUploadManager.instances.get(this._options.manager).remove(this)
},_processResponse:function($super,A){$super(A);
this._options.fileId=A.id
},_delete:function($super){if(!this._options.del.parameters){this._options.del.parameters={}
}this._options.del.parameters.file_id=this._options.file_id;
$super()
},_ondelete:function($super){this.onDelete();
this.destroy()
}});mtt.FileUploadManager=Class.create({initialize:function(A,B){this._options=B;
this.container=$(A);
mtt.FileUploadManager.instances.set(this.container.id,this);
this._fileUploads=$A();
this.container.getElementsByClassName("fileUpload").each(function(C){if(C.id==(this.container.id+"prototype")){this._prototype=C.remove()
}else{this.add(this._createFileUpload(C))
}},this)
},add:function(A){mtt.FileUpload.onSave=this._onSave.bind(this);
this._fileUploads.push(A)
},remove:function(A){this._fileUploads=this._fileUploads.without(A)
},size:function(){return this._fileUploads.size()
},_createFileUpload:function(C){var B=Object.clone(this._options.commonOptions);
var A=C.down("input[name=fileId]");
if(A){B.fileId=A.value
}B.manager=this.container.id;
C.id=mtt.FileUploadManager.generateId();
return new mtt.ManagedFileUpload(C,B)
},_onSave:function(){this.container.removeClassName("uploadState");
if((!this._options.max||this._fileUploads.size()<this._options.max)&&this._fileUploads.last()&&!this._fileUploads.last().container.hasClassName("uploadState")){this.add(this._createFileUpload(this.container.appendChild(this._prototype.cloneNode(true))))
}}});Object.extend(mtt.FileUploadManager,{instances:$H(),generateId:function(){if(!mtt.FileUploadManager._lastId){mtt.FileUploadManager._lastId=0;
mtt.FileUploadManager.instances.values().each(function(A){mtt.FileUploadManager._lastId+=A.size()
})}else{mtt.FileUploadManager._lastId++
}return"newManagedFileUpload"+mtt.FileUploadManager._lastId
}});mtt.starRater=Class.create({containerClick:function(A){Event.stop(A)
},containerMouseOver:function(A){if(isRealMouseEventTarget(A,this.container)){if(!this.container.hasClassName("star-rating-hover")){this.container.addClassName("star-rating-hover");
this.container.getOffsetParent().setStyle({zIndex:2})
}}},containerMouseOut:function(B){if(isRealMouseEventTarget(B,this.container)){this.container.removeClassName("star-rating-hover");
this.container.getOffsetParent().setStyle({zIndex:1});
if(this.rater){if(this.rater.hasClassName("mynewrate")){this.rater.removeClassName("mynewrate");
this.rater.addClassName("myrate")
}var A=this.rater.classNames().find(function(C){return C.startsWith("mynewrate")
});if(A){this.rater.removeClassName(A);
this.rater.addClassName(A.replace("mynew",""))
}}}},raterMouseOver:function(A){if(!this.rater.hasClassName("mynewrate")&&!this.container.hasClassName("busy")){var B=A.element();
var C;
if(B.nodeName=="LI"){C=B.childElements()[0].firstChild.nodeValue
}else{if(B.nodeName=="A"){C=B.firstChild.nodeValue
}}if(C){this.rater.removeClassName(this.rater.classNames().find(function(D){return D.startsWith("hl")
}));this.rater.addClassName("hl"+C)
}}Event.stop(A)
},raterMouseOut:function(A){if(!this.rater.hasClassName("mynewrate")&&!this.container.hasClassName("busy")&&isRealMouseEventTarget(A,this.rater)){this.rater.removeClassName(this.rater.classNames().find(function(B){return B.startsWith("hl")
}))}Event.stop(A)
},raterClick:function(A){if(!this.rater.hasClassName("mynewrate")){var B=Event.element(A);
var C;
if(B.nodeName=="LI"){C=B.childElements()[0].firstChild.nodeValue
}else{if(B.nodeName=="A"){C=B.firstChild.nodeValue
}}this.container.addClassName("busy");
this.rateCallback(C)
}Event.stop(A)
},initialize:function(A,B,C){this.container=$(A);
this.rater=$(B);
if(!this.container){console.error('starrater creation failed: "container" not exist.')
}this.rateCallback=(typeof C!="function")?Prototype.emptyFunction:C;
Event.observe(this.container,"click",this.containerClick);
Event.observe(this.container,"mouseover",this.containerMouseOver.bindAsEventListener(this));
Event.observe(this.container,"mouseout",this.containerMouseOut.bindAsEventListener(this));
if(this.rater){Event.observe(this.rater,"mouseover",this.raterMouseOver.bindAsEventListener(this));
Event.observe(this.rater,"mouseout",this.raterMouseOut.bindAsEventListener(this));
Event.observe(this.rater,"click",this.raterClick.bindAsEventListener(this))
}},update:function(B,D,C,E){if(C<0||C>5){console.error("invalid rate value:"+C)
}if(E<0||E>5){console.error("invalid myrate value:"+C)
}var A=B.getElementsByTagName("ul")[0];
A.className="rate"+C.toString().replace(/\.0|\./g,"");
if(B.hasClassName("star-rating-hover")&&B.hasClassName("busy")){D.className="mynewrate mynewrate"+E
}else{D.className="myrate rate"+E
}B.removeClassName("busy")
}});mtt.advertisement={init:function(){mtt.advertisement.geoCompleter=new mtt.GeoCompleter({element:null});
console.log("wizardStep:"+mtt.page.wizardStep);
if($("step2")){mtt.advertisement.wizardInit();
mtt.advertisement._initAccount();
mtt.advertisement.calculateAccount();
mtt.advertisement.step2()
}$$(".imageViewA").each(function(B){var C=new mtt.ImageView(B);
B.observe("click",C.show.bind(C))
});if(document.getElementsByClassName("keywordsContainer").length!=0){$("tagsInput","tradenameInput","servicesInput","productsInput").invoke("hide");
keywordInputs=$("newKeywordService","newKeywordProduct","newKeywordTradename","newKeywordTag");
keywordInputs.each(function(B){Event.observe(B,"keypress",function(C){if(C.keyCode==Event.KEY_RETURN){Event.stop(C)
}})});
if($("statusNew").value==1){$$(".keywords h3").each(function(B){Event.observe(B,"click",function(){this.next().toggle()
})})}else{$$(".keywords h3").each(function(B){B.setStyle("background: none; cursor: default;")
})}keywordDivs=$("productsKeywords","serviceKeywords","tradnameKeywords","tagKeywords");
keywordDivs.each(function(B){mtt.advertisement._initDeleteKeyword(B)
});var A=$("showOnMap");
if(A){A.observe("click",mtt.advertisement.btnShowOnMapClick);
if($("advertBean.mapCoordinate.y").value==""){mtt.advertisement.btnShowOnMapClick(null,true)
}else{mtt.advertisement.refreshMarkerFromInputValues("")
}}}if(mtt.page.images){mtt.page.images.each(function(B){B.value.onChange=function(C){mtt.advertisement.calculateAccount()
}})}$("cmsform")&&$("cmsform").observe("submit",function(C){var B=$("acceptConditions");
if(!B){return 
}if(!B.checked){if(C.explicitOriginalTarget.id!="wizPreview"){mtt.showMessage(mtt.lang.confirmSubmit);
B.scrollTo();
C.stop();
return false
}}});mtt.advertisement.step1();
return false
},refreshMarkerFromInputValues:function(A){console.log("refreshMarkerFromInputValues",$("advertBean.mapCoordinate.x").value,$("advertBean.mapCoordinate.y").value,mtt.poiHandler._map);
mtt.poiHandler.removePoisByType("draggable");
mtt.poiHandler.addPoi({adId:"000",x:$("advertBean.mapCoordinate.x").value,y:$("advertBean.mapCoordinate.y").value,type:"draggable",label:"+",address:A,onDragEnd:function(B){$("advertBean.mapCoordinate.x").value=B.latLng.lng();
$("advertBean.mapCoordinate.y").value=B.latLng.lat()
}});mtt.poiHandler.zoomToAllPois()
},refreshOperationalTerritory:function(B){var A=$("operationalCityName");
A.options.length=0;
A.options[0]=new Option(mtt.lang.refreshing,"");
A.disable();
new mtt.Ajax.Request(mtt.url.territoryProcesser,{method:"get",parameters:{address:B},onComplete:function(I,G,H){var E=H.result.contentAsText.evalJSON();
A.options.length=0;
var D=E.values;
var F=E.selectedIndex;
for(var C=0;
C<D.length;
C++){A.options[C]=new Option(D[C],D[C])
}$("operationalCityName").options.selectedIndex=F;
A.enable()
}.bind(this)})
},wizardInit:function(){console.log("wizardInit: "+mtt.page.wizardStep);
if(mtt.page.wizardStep==1){$("step2").show()
}if($("wizNextStep")){Event.observe("wizNextStep","click",function(B){if($("step2").visible()){return false
}B.stop();
$("step2").show();
$("step1").hide();
window.scrollTo(0,0);
mtt.advertisement.step2()
})}$$(".wizCancel").each(function(B){Event.observe(B,"click",function(D){D.stop();
if($("step1").visible()){var C=confirm(mtt.lang.wizardConfirmText);
if(C){document.location.href=mtt.url.userPage
}else{return false
}}else{$("step1").show();
$("step2").hide();
mtt.advertisement.step1()
}})});
var A=function(){var B=$("clickToCallHint");
if($F("advertBean.clickToCall")=="false"){B.hide();
return 
}if(($("advertBean.phone1-areacode").value!=""&&$("advertBean.phone1-number").value!="")||($("advertBean.phone2-areacode").value!=""&&$("advertBean.phone2-number").value!="")||($("advertBean.phone3-areacode").value!=""&&$("advertBean.phone3-number").value!="")){B.hide()
}else{B.show()
}};Event.observe("advertBean.phone1-areacode","keyup",A);
Event.observe("advertBean.phone1-number","keyup",A);
Event.observe("advertBean.phone2-areacode","keyup",A);
Event.observe("advertBean.phone2-number","keyup",A);
Event.observe("advertBean.phone3-areacode","keyup",A);
Event.observe("advertBean.phone3-number","keyup",A);
Event.observe("advertBean.clickToCall","change",A);
A()},btnShowOnMapClick:function(E,B){E&&E.stop&&E.stop();
var C=(B)?Prototype.emptyFunction:mtt.showMessage;
mtt.advertisement.addrFields=$A([$F("advertBean.address.postCode"),$F("addressCityName"),$F("advertBean.address.street"),$F("locationTypeName"),$F("houseNumberFull")]);
mtt.advertisement.addrFieldsExtended=mtt.advertisement.addrFields.clone();
if(mtt.advertisement.addrFields.join("")==""){C(mtt.lang.notEnoughInputData);
return 
}var F=mtt.advertisement.addrFieldsExtended.clone();
var D=F.last();
F[F.length-1]=D.substring(0,(D.indexOf(" ")==-1)?D.length:D.indexOf(" "));
var A=F.join(" ");
mtt.advertisement.geoCompleter.searchAddress(A,true,mtt.advertisement.processGeocoderResult);
mtt.advertisement.refreshOperationalTerritory(A);
return false
},processGeocoderResult:function(A){$("advertBean.mapCoordinate.x").value=A.lng;
$("advertBean.mapCoordinate.y").value=A.lat;
mtt.advertisement.refreshMarkerFromInputValues(A.label)
},setTopRank:function(){if($$(".toprank")[1].checked==true){$("isTopRank").value="true"
}if($$(".toprank")[0].checked==true){$("isTopRank").value="false"
}mtt.advertisement.checkTopRank()
},checkTopRank:function(){if($("isTopRank").value=="true"){if($("topRankDate")){$("topRankDate").show()
}if($("packageDate")){$("packageDate").hide()
}$("emphasized").hide()
}if($("isTopRank").value=="false"){if($("topRankDate")){$("topRankDate").hide()
}if($("packageDate")){$("packageDate").show()
}$("emphasized").show()
}},setKeywordType:function(A){mtt.advertisement.addKeyword.type=A;
switch(A){case"PRODUCT":mtt.advertisement.addKeyword.inputToUpdate=$("productsKeywords");
mtt.advertisement.addKeyword.keyword=$("newKeywordProduct");
break;
case"SERVICE":mtt.advertisement.addKeyword.inputToUpdate=$("serviceKeywords");
mtt.advertisement.addKeyword.keyword=$("newKeywordService");
break;
case"TRADENAME":mtt.advertisement.addKeyword.inputToUpdate=$("tradnameKeywords");
mtt.advertisement.addKeyword.keyword=$("newKeywordTradename");
break;
case"TAG":mtt.advertisement.addKeyword.inputToUpdate=$("tagKeywords");
mtt.advertisement.addKeyword.keyword=$("newKeywordTag");
break}},addKeyword:function(A){mtt.advertisement.setKeywordType(A);
new mtt.Ajax.Request(mtt.url.keywords,{method:"get",parameters:{method:"AddKeyword",keywordType:A,newKeyword:mtt.advertisement.addKeyword.keyword.value,topRank:$("isTopRank").value},onComplete:this.updateKeyword})
},updateKeyword:function(C,A,B){mtt.advertisement.addKeyword.inputToUpdate.update(B.result.contentAsText);
mtt.advertisement._initDeleteKeyword(mtt.advertisement.addKeyword.inputToUpdate);
mtt.advertisement.calculateAccount()
},_initDeleteKeyword:function(A){if($("statusNew").value==1){$$("#"+A.id+" ul li").each(function(C,B){C.innerHTML='<a title="'+C.innerHTML+'">'+C.innerHTML+"</a><span>"+mtt.lang.deleteKeyword+"</span>";
Event.observe(C.down().next(),"click",function(){mtt.advertisement.deleteKeyword(B,C.up().up().id)
})})}},deleteKeyword:function(A,B){switch(B){case"tradnameKeywords":mtt.advertisement.addKeyword.inputToUpdate=$("tradnameKeywords");
B="TRADENAME";
break;
case"productsKeywords":mtt.advertisement.addKeyword.inputToUpdate=$("productsKeywords");
B="PRODUCT";
break;
case"serviceKeywords":mtt.advertisement.addKeyword.inputToUpdate=$("serviceKeywords");
B="SERVICE";
break;
case"tagKeywords":mtt.advertisement.addKeyword.inputToUpdate=$("tagKeywords");
B="TAG";
break}new mtt.Ajax.Request(mtt.url.keywords,{method:"get",parameters:{method:"DeleteKeyword",keywordType:B,keywordNum:A},onComplete:this.updateKeyword})
},_initAccount:function(){if($("professionText")){Event.observe("professionText","keyup",function(){mtt.advertisement.calculateAccount()
})}$$(".toprank").each(function(A){Event.observe(A,"change",mtt.advertisement.setTopRank)
});if($("topRankDate")){$("topRankDate").observe("change",mtt.advertisement.calculateAccount)
}Event.observe("advertBean.emphasized","change",mtt.advertisement.calculateAccount);
mtt.advertisement.checkTopRank()
},step1:function(){if($("wizNextStep")){$("wizNextStep").value=$("wizNextStep_step1").innerHTML;
$("wizCancel").value=$("wizCancel_step1").innerHTML
}},step2:function(){if($("wizNextStep")){$("wizNextStep").value=$("wizNextStep_step2").innerHTML;
$("wizCancel").value=$("wizCancel_step2").innerHTML
}},calculateAccount:function(){var B="";
var C=0;
if($("productsKeywords")){keywordContainers=$("productsKeywords","serviceKeywords","tradnameKeywords","tagKeywords");
var A=0;
keywordContainers.each(function(D){A+=$$("#"+D.id+" ul li").length
});if(A!=0){if(A>10){B="Premium";
$("accountKeywords").update(mtt.lang.premiumPackage)
}else{if(A>=6){B="Practical";
$("accountKeywords").update(mtt.lang.practicalPackage)
}else{B="Basic";
$("accountKeywords").update(mtt.lang.basicPackage)
}}}else{$("accountKeywords").update("&nbsp;")
}}if(mtt.page.images){mtt.page.images.each(function(D){if(D.key=="logoImage"&&D.value.uploaded){B="Premium";
$("accountLogoUsage").update(mtt.lang.premiumPackage)
}else{if(D.key=="logoImage"&&!D.value.uploaded){$("accountLogoUsage").update("&nbsp;")
}}})}if($("advertBean.emphasized").value=="true"&&$("isTopRank").value=="false"){$("accountEmphasizedBg").update("Igen");
C+=mtt.page.emphasizedPrice
}else{$("accountEmphasizedBg").update("&nbsp;")
}if($("isTopRank").value=="true"){B="TopRank"
}if($("totalAmount")){switch(B){case"":$("totalAmount").update("&nbsp;");
break;
case"Premium":C+=mtt.page.premiumPrice;
$("determinedPackage").update(mtt.lang.premiumPackage);
break;
case"Practical":C+=mtt.page.practicalPrice;
$("determinedPackage").update(mtt.lang.practicalPackage);
break;
case"Basic":C+=mtt.page.basicPrice;
$("determinedPackage").update(mtt.lang.basicPackage);
break;
case"TopRank":$("determinedPackage").update(mtt.lang.topRankPackage);
if($("topRankDate")){switch($("topRankDate").value){case"3":C=mtt.page.topRankPrice1;
break;
case"6":C=mtt.page.topRankPrice2;
break;
case"12":C=mtt.page.topRankPrice3;
break}}break
}if(C!=0){$("totalAmount").update(C+" Ft");
$("totalAmountField").value=C
}}}};mtt.staticAutocomplete=Class.create(PAjax.Autocompleter,{initialize:function($super){var B=$A(arguments).without($super);
var A=B[3];
A.hideOnStart=false;
A.onHide=Prototype.emptyFunction;
A.onShow=function(C,D){D.show()
};$super.apply(this,B);
this.activate()
}});mtt.advertview={raters:new Array(),init:function(){if(mtt.page.adList.length>0){jQuery.each(mtt.page.adList,function(D,E){mtt.poiHandler.addPoi({adId:((E[4]=="topranked")?"topRanked_":"")+E[0],x:E[1],y:E[2],tmp:E[3],type:(E[4]=="topranked")?"topranked":"servicepoi",label:(E[4]=="topranked")?"*":E[3],subType:E[5]})
});var C=(mtt.page.adList[0][4]!=""&&mtt.page.adList[0][4]!="0"&&mtt.page.adList[0][4]!="NULL");
if(C){var B=mtt.page.adList[0][4]>20?Math.round(mtt.page.adList[0][4]/150):mtt.page.adList[0][4];
console.log("customZoom: ",mtt.page.adList[0][4],B);
mtt.poiHandler._map.setOptions({zoom:B})
}else{mtt.poiHandler.zoomToAllPois()
}}$$(".imageViewA").each(function(D){var E=new mtt.ImageView(D);
D.observe("click",E.show.bind(E))
});if(document.getElementsByClassName("rating").length!=0){for(var A=0;
A<5;A++){mtt.advertview.raters.push(new mtt.starRater("starRater"+A,"starRaterMy"+A,mtt.advertview.raterClick.bind(mtt.advertview,A,mtt.page.adList[0][0])))
}}},raterClick:function(C,B,A){new mtt.Ajax.Request(mtt.url.starRater,{method:"get",parameters:{method:"Rate",advertid:B,ratingtype:C,ratingvalue:A},onComplete:mtt.advertview.raterUpdate})
},raterUpdate:function(G,E,F){var B=F.result.contentAsText.evalJSON();
var D=document.getElementsByClassName("star-rater-avgOfAd_"+B.advertId);
for(var A=0;
A<D.length;
A++){var C=$(D[A]);
C.getElementsByTagName("UL")[0].className="rate"+B.averageRating
}for(var A=0;
A<mtt.advertview.raters.length;
A++){mtt.advertview.raters[A].update($("starRater"+A),$("starRaterMy"+A),B.allRatings[A],B.userRatings[A])
}}};mtt.newsletter={init:function(){if(!$("selectAll")){return 
}$("selectAll").observe("click",mtt.newsletter.setSelectAll)
},setSelectAll:function(){var B=($("selectAll").checked)?true:false;
for(var A=1;
A<=6;A++){$("category"+A).checked=B
}}};mtt.search={init:function(){new stdPopup("topPagerJumpTo","topPagerPopup","topPagerPopupTop","topPagerPopupBottom",{hideDelay:100});
new stdPopup("bottomPagerJumpTo","bottomPagerPopup","bottomPagerPopupTop","bottomPagerPopupBottom",{hideDelay:100});
var A=$("bottomPagerPopup");
if(A){A.setStyle({top:"-"+(A.getHeight()-((Prototype.Browser.IE)?5:15))+"px"})
}mtt.page.adList.each(function(B){mtt.poiHandler.addPoi({adId:((B[4]=="topranked")?"topRanked_":"")+B[0],x:B[1],y:B[2],num:B[3],type:(B[4]=="topranked")?"topranked":"servicepoi",label:(B[4]=="topranked")?"*":B[3],subtype:B[5]})
});if(mtt.poiHandler){mtt.poiHandler.zoomToAllPois()
}if(!mtt.adsDisabled){document.fire("application:launchAds")
}}};mtt.SearchOnMap=JClass.extend({init:function(){jQuery("#refreshResults").click(jQuery.proxy(this.searchByMapRegion,this));
jQuery("#refreshMapAdverts").click(jQuery.proxy(this.refreshByMapRegion,this));
this.rebuildAfterPaging()
},rebuildAfterPaging:function(){this.pagerPopup=new stdPopup("mapPagerJumpTo","mapPagerPopup","mapPagerPopupTop","mapPagerPopupBottom");
jQuery.each(mtt.page.adList,function(A,B){mtt.poiHandler.addPoi({adId:((B[4]=="topranked")?"topRanked_":"")+B[0],x:B[1],y:B[2],tmp:B[3],type:(B[4]=="topranked")?"topranked":"servicepoi",label:(B[4]=="topranked")?"*":B[3],subType:B[5]})
});$$(".pagerContainer a").each(this.pagingEvent.bind(this,"click"));
$$(".pagerContainer select").each(this.pagingEvent.bind(this,"change"));
mtt.poiHandler.zoomToAllPois();
if(mtt.page.adList.length>0){this.autoOpener=setInterval(jQuery.proxy(function(){if(!mtt.poiHandler._pois[0]._listItemDetails){return 
}var A=mtt.poiHandler._pois[0].toggleListItem();
clearInterval(this.autoOpener);
this.autoOpener=null
},this),100)
}},pagingEvent:function(A,B,C){B.observe(A,function(D){D.stop();
if(B.tagName.toLowerCase()=="a"){var E=B.getAttribute("HREF").toQueryParams()
}if(B.tagName.toLowerCase()=="select"){var E=B.options[B.selectedIndex].value.toQueryParams();
E.page=0
}delete E.userid;
delete E.tid;
delete E.back_from_gettid;
delete E.status;
this.search(E,D)
}.bind(this))
},search:function(B,A){A&&A.stop();
this.prepareToAjax();
B.method="MapSearchAgain";
$("print").down("a").href=mtt.url.searchPrint+"?"+$H(B).toQueryString();
new mtt.Ajax.Request(mtt.url.mapResultList,{method:"get",parameters:B,onComplete:this.processSearchAjaxResult.bind(this)})
},searchByMapRegion:function(B){var C=null;
if(document.location.toString().indexOf("?")!=-1){C=document.location.toString().toQueryParams();
delete C.userid;
delete C.tid;
delete C.back_from_gettid;
delete C.status;
delete C.where
}else{C={what:$("refreshResults").down(".keyword").value}
}var A=mtt.poiHandler._map.getBounds();
C.dCenterX=mtt.poiHandler._map.getCenter().lng();
C.dCenterY=mtt.poiHandler._map.getCenter().lat();
C.dMinX=A.getNorthEast().lng();
C.dMinY=A.getNorthEast().lat();
C.dMaxX=A.getSouthWest().lng();
C.dMaxY=A.getSouthWest().lat();
C.method="MapSearchAgain";
this.prepareToAjax();
$("print").down("a").href=mtt.url.searchPrint+"?"+$H(C).toQueryString();
new mtt.Ajax.Request(mtt.url.mapResultList,{method:"get",parameters:C,onComplete:this.processSearchAjaxResult.bind(this)});
return false
},refreshByMapRegion:function(B){var C=document.location.toString().toQueryParams();
delete C.userid;
delete C.tid;
delete C.back_from_gettid;
delete C.status;
delete C.where;
var A=mtt.poiHandler._map.getBounds();
C.dCenterX=mtt.poiHandler._map.getCenter().lng();
C.dCenterY=mtt.poiHandler._map.getCenter().lat();
C.dMinX=A.getNorthEast().lng();
C.dMinY=A.getNorthEast().lat();
C.dMaxX=A.getSouthWest().lng();
C.dMaxY=A.getSouthWest().lat();
C.type="MapSearch";
C.method="MapSearchAgain";
this.prepareToAjax();
$("print").down("a").href=mtt.url.searchPrint+"?"+$H(C).toQueryString();
new mtt.Ajax.Request(mtt.url.mapResultList,{method:"get",parameters:C,onComplete:this.processSearchAjaxResult.bind(this)});
return false
},processSearchAjaxResult:function(C,A,B){$("mapResultList").update(B.result.contentAsText);
setTimeout(function(){this.rebuildAfterPaging();
this.setBusyState(false)
}.bind(this),100)
},prepareToAjax:function(){mtt.page.adList=[];
mtt.poiHandler.removePoisByType("servicepoi");
mtt.poiHandler.removePoisByType("topranked");
this.setBusyState(true);
$("mapResultList").update()
},setBusyState:function(A){if(A){mtt.poiHandler.detachEvents();
$("mapBusyState").setStyle({width:$("map").getWidth()+"px",height:$("map").getHeight()+"px",left:$("map").cumulativeOffset()[0]+"px",top:$("map").cumulativeOffset()[1]+"px",display:"block"});
$("mapResultListBusyState").setStyle({width:$("mapResultList").getWidth()+"px",height:"500px",display:"block"});
$("refreshResults")&&$("refreshResults").addClassName("disabled");
$("refreshMapAdverts")&&$("refreshMapAdverts").addClassName("disabled");
this.pagerPopup.destroy()
}else{$("mapBusyState").hide();
$("mapResultListBusyState").hide();
$("refreshResults")&&$("refreshResults").removeClassName("disabled");
$("refreshMapAdverts")&&$("refreshMapAdverts").removeClassName("disabled")
}}});mtt.userdata={init:function(){if(mtt.page.adCoordinates){mtt.poiHandler.addPoi({adId:"000",x:mtt.page.adCoordinates[0],y:mtt.page.adCoordinates[1],type:"address",label:"+",address:null})
}mtt.poiHandler.zoomToAllPois();
var C=$("oldPassword");
if(C){C.setAttribute("autoComplete","off")
}var B=$("newPassword1");
if(B){B.setAttribute("autoComplete","off")
}var A=$("newPassword2");
if(A){A.setAttribute("autoComplete","off")
}}};mtt.messages={init:function(){if($$(".userMessages").length==1){this.bindPager()
}},deleteMessage:function(B,A){new mtt.Ajax.Request(mtt.url.messages,{method:"get",parameters:{method:"Delete",id:B,page:A},onComplete:this.updateMessages.bind(this,false)})
},viewMessage:function(B,A){new mtt.Ajax.Request(mtt.url.messages,{method:"get",parameters:{method:"Select",id:B,page:A},onComplete:this.updateMessages.bind(this,true)})
},bindPager:function(){mtt.messages.pagerPopupObj=new stdPopup("messagePagerJumpTo","messagePagerPopup","messagePagerPopupTop","messagePagerPopupBottom");
$$("#messagesHeader a").each(function(A){if(A.getAttribute("REL")!="fixed"){var B=A.getAttribute("HREF").toQueryParams();
delete B.userid;
delete B.tid;
delete B.back_from_gettid;
delete B.status;
B.method="GetAjaxList";
A.observe("click",function(C){C.stop();
new mtt.Ajax.Request(mtt.url.messages,{method:"get",parameters:B,onComplete:mtt.messages.updateMessages.bind(this,false)})
}.bind(this))
}})},detachPager:function(){$$("#messagesHeader a").each(function(A){A.stopObserving()
});mtt.messages.pagerPopupObj.destroy()
},updateMessages:function(A,D,B,C){mtt.messages.detachPager();
$$(".userMessages")[0].replace(C.result.contentAsText);
mtt.messages.bindPager();
if(A){$$(".loadedMessage")[0].highlight()
}}};mtt.addresssearch={init:function(){mtt.addresssearch.geoCompleter=new mtt.GeoCompleter({element:jQuery("#where_a"),onAddressSelected:mtt.addresssearch.onAddressSelected});
if(!mtt.page||mtt.page.type!="addresssearch"){return 
}this.origiPrintObj=urlStringToParamObjs(jQuery("#print a").attr("href"));
if((jQuery("#where_a").val()!="")&&!jQuery("#where_a").hasClass("showDefaultValue")){if(window.documentLoaded){mtt.addresssearch.goSearch()
}else{jQuery(window).load(function(){mtt.addresssearch.goSearch()
})}}this.initCompanyList()
},onAddressSelected:function(A){if(!mtt.page||mtt.page.type!="addresssearch"){return 
}if(A){mtt.poiHandler.removePoisByType("address");
mtt.poiHandler.addPoi({adId:"000",x:A.lng,y:A.lat,type:"address",label:"+",address:A.label});
mtt.poiHandler.zoomToAllPois();
window.document.title=A.label+" "+mtt.lang.addressSrchTitle;
$$(".addressSearchH")[0].down("span").update(mtt.lang.addressSrchHeader+" "+A.label);
var C={where_address:A.label};
jQuery.extend(mtt.addresssearch.origiPrintObj.params,C);
jQuery("#print a").attr("href",mtt.addresssearch.origiPrintObj.url+"?"+jQuery.param(mtt.addresssearch.origiPrintObj.params));
var B=$("mainTabs");
if(B!=null){$("mainTabs").getElementsBySelector("li a").each(function(D){var F=D.href.substr(0,D.href.indexOf("/",10));
var E=D.href.substr(D.href.indexOf("/",10),D.href.length);
if(E!="/"){D.href=F+mtt.url.addressSearch+"?"+$H(hrefParams).toQueryString()
}}.bind(this))
}}},goSearch:function(A){if($("activeTab").value=="addressSearch"){A&&A.stop();
mtt.addresssearch.geoCompleter.searchAddress(jQuery("#where_a").val(),true,mtt.addresssearch.onAddressSelected)
}},initCompanyList:function(){$("companiesOnMap").getElementsBySelector(".categoryLabel").each(function(A){A.observe("click",function(C){var B=A.next();
if(C.element().tagName.toLowerCase()=="input"){B.getElementsBySelector("input").each(function(D){D.checked=C.element().checked
}.bind(this));
this.refreshCompanies();
return 
}if(B.visible()){A.next().blindUp();
A.removeClassName("opened")
}else{A.next().blindDown();
A.addClassName("opened")
}}.bind(this))
}.bind(this));
$("companiesOnMap").getElementsBySelector(".item").each(function(A){A.observe("click",function(B){this.refreshCompanies()
}.bind(this))
}.bind(this))
},refreshCompaniesTimer:null,refreshCompanies:function(){clearTimeout(mtt.addresssearch.refreshCompaniesTimer);
mtt.addresssearch.refreshCompaniesTimer=setTimeout("mtt.addresssearch.requestCompanies();",1000)
},requestCompanies:function(){var C=[];
var B=$("companiesOnMap").getElementsBySelector(".item").each(function(E){if(E.checked){C.push(E.value)
}}.bind(this));
mtt.page.adList=[];
var D=mtt.poiHandler._map.getBounds();
var A=mtt.poiHandler._map.getCenter();
new mtt.Ajax.Request(mtt.url.mapResultList,{method:"get",parameters:{method:"MapSearchAgain",type:"MapSearchByKeyword",typek:C,count:50,dMinX:D.getNorthEast().lng(),dMinY:D.getNorthEast().lat(),dMaxX:D.getSouthWest().lng(),dMaxY:D.getSouthWest().lat(),dCenterX:A.lng(),dCenterY:A.lat()},onComplete:mtt.addresssearch.updateMap})
},updateMap:function(A,B,C){$("companiesOnMapTmpContainer").update(C.result.contentAsText);
mtt.fixIwiwLikes();
mtt.poiHandler.removePoisByType("servicepoi");
setTimeout(function(){mtt.page.adList.each(function(D){mtt.poiHandler.addPoi({adId:((D[4]=="topranked")?"topRanked_":"")+D[0],x:D[1],y:D[2],tmp:D[3],type:(D[4]=="topranked")?"topranked":"servicepoi",label:(D[4]=="topranked")?"*":"",subtype:D[5]})
});if(mtt.page.adList.length>0){mtt.poiHandler.zoomToAllPois()
}},100)
}};mtt.routeplanner={init:function(){mtt.routeplanner.fromGC=this.createAutoComplete(jQuery("#from"),jQuery("#fromX, #routePlannerSettings input[name=fromX]"),jQuery("#fromY, #routePlannerSettings input[name=fromY]"));
mtt.routeplanner.toGC=this.createAutoComplete(jQuery("#to"),jQuery("#toX, #routePlannerSettings input[name=toX]"),jQuery("#toY, #routePlannerSettings input[name=toY]"));
mtt.routeplanner.searchSubmit=$("routePlannerSubmit");
jQuery("#serviceSearchForm").submit(mtt.routeplanner.onSearchFormSubmit);
setInterval(mtt.routeplanner.formEnabler,500);
mtt.routeplanner.formEnabler();
if(!mtt.page||mtt.page.type!="routeplanner"){return 
}if(jQuery("#print a").length>0){this.origiPrintObj=urlStringToParamObjs(jQuery("#print a").attr("href"))
}this.directionsService=new google.maps.DirectionsService();
this.directionsDisplay=new google.maps.DirectionsRenderer({suppressMarkers:true,map:mtt.poiHandler._map,panel:jQuery(".itiner").get(0)});
google.maps.event.addListener(this.directionsDisplay,"directions_changed",this.onDirectionsChanged);
if(mtt.routeplanner.isProperlyFilled()){this.calculateDirections()
}else{this.initRoutePlannerByAddressStrs()
}jQuery("#useTollFreeRoutes").change(this.calculateDirections);
jQuery("#drivingMode").change(this.calculateDirections);
jQuery("#fuelConsumption, #fuelPrice").keyup(this.recalculateTotalFuelPrice)
},initRoutePlannerByAddressStrs:function(){mtt.routeplanner.fromGC.searchAddress(jQuery("#from").val(),true,jQuery.proxy(mtt.routeplanner.directGeoCodeCb,this,"from"));
mtt.routeplanner.toGC.searchAddress(jQuery("#to").val(),true,jQuery.proxy(mtt.routeplanner.directGeoCodeCb,this,"to"))
},directGeoCodeCb:function(A,B){jQuery("#"+A+"X").val(B.lng);
jQuery("#"+A+"Y").val(B.lat);
if(mtt.routeplanner.isProperlyFilled()){this.calculateDirections();
var C={fromX:jQuery("#fromX").val(),fromY:jQuery("#fromY").val(),toX:jQuery("#toX").val(),toY:jQuery("#toY").val(),from:jQuery("#from").val(),to:jQuery("#to").val()};
if(this.origiPrintObj){jQuery.extend(mtt.routeplanner.origiPrintObj.params,C);
jQuery("#print a").attr("href",mtt.routeplanner.origiPrintObj.url+"?"+jQuery.param(mtt.routeplanner.origiPrintObj.params))
}}},createAutoComplete:function(B,C,A){return new mtt.GeoCompleter({element:B,onAddressSelected:jQuery.proxy(this.onAddressSelected,this,B,C,A),onBeforeSearch:jQuery.proxy(this.onBeforeSearch,this,B)})
},isProperlyFilled:function(){return(jQuery("#fromX").val()!="")&&(jQuery("#fromX").val()!="0.0")&&(jQuery("#fromY").val()!="")&&(jQuery("#fromY").val()!="0.0")&&(jQuery("#toX").val()!="")&&(jQuery("#toX").val()!="0.0")&&(jQuery("#toY").val()!="")&&(jQuery("#toY").val()!="0.0")&&(jQuery("#from").val()!="")&&(!jQuery("#from").hasClass("showDefaultValue"))&&(jQuery("#to").val()!="")&&(!jQuery("#to").hasClass("showDefaultValue"))
},calculateDirections:function(){if(mtt.routeplanner.isProperlyFilled()){mtt.page.adList=[];
mtt.page.adList[0]=["1",jQuery("#fromX").val(),jQuery("#fromY").val(),"1","routePlanner"];
mtt.page.adList[1]=["2",jQuery("#toX").val(),jQuery("#toY").val(),"2","routePlanner"];
mtt.poiHandler.removePoisByType("routePlanner");
mtt.page.adList.each(function(A){mtt.poiHandler.addPoi({adId:A[0],x:A[1],y:A[2],num:A[3],type:A[4],label:A[3]})
});mtt.poiHandler.zoomToAllPois();
mtt.routeplanner.directionsService.route({origin:jQuery("#from").val(),destination:jQuery("#to").val(),avoidTolls:!jQuery("#useTollFreeRoutes").is(":checked"),travelMode:google.maps.DirectionsTravelMode[jQuery("#drivingMode").val()]},function(B,A){if(A==google.maps.DirectionsStatus.ZERO_RESULTS){jQuery(".itiner").html(mtt.lang.cantPlanRoute)
}else{if(A==google.maps.DirectionsStatus.OK){mtt.routeplanner.directionsDisplay.setDirections(B)
}}})}mtt.routeplanner.recalculateTotalFuelPrice()
},onAddressSelected:function(C,D,B,A){B.val(A.lat);
D.val(A.lng)
},onBeforeSearch:function(A){jQuery("#"+A.attr("id")+"X").val("");
jQuery("#"+A.attr("id")+"Y").val("")
},onDirectionsChanged:function(){setTimeout(function(){if(jQuery(".itiner .adp-directions").length==0){jQuery(".itiner").html(mtt.lang.cantPlanRoute);
return 
}jQuery(".itiner .adp-directions").parent("div").addClass("route_textual");
jQuery.each(jQuery(".adp-placemark img"),function(B,A){if(B<2){jQuery(A).after('<div class="directionsPanelPoi">'+(B+1)+"</div>").remove()
}})},100)
},updatePrintUrl:function(){if(!this.origiPrintObj){return 
}var A={useTollFreeRoutes:jQuery("#useTollFreeRoutes").is(":checked"),drivingMode:jQuery("#drivingMode").val(),fuelConsumption:jQuery("#fuelConsumption").val(),fuelPrice:jQuery("#fuelPrice").val(),fuelCosts:jQuery("#fuelCosts").val()};
jQuery.extend(mtt.routeplanner.origiPrintObj.params,A);
jQuery("#print a").attr("href",mtt.routeplanner.origiPrintObj.url+"?"+jQuery.param(mtt.routeplanner.origiPrintObj.params))
},recalculateTotalFuelPrice:function(){var A=parseFloat(jQuery("#fuelConsumption").val());
var C=parseFloat(jQuery("#fuelPrice").val());
var B=parseInt(jQuery(".adp-summary span:first").text(),10);
if(!isNaN(A)&&!isNaN(C)&&!isNaN(B)&&A>0&&C>0&&A>0){jQuery("#fuelCosts").val(Math.round(B/100*A*C))
}else{jQuery("#fuelCosts").val("########")
}mtt.routeplanner.updatePrintUrl()
},formEnabler:function(){if(mtt.routeplanner.isProperlyFilled()){mtt.routeplanner.enableRoutePlannerForm()
}else{mtt.routeplanner.disableRoutePlannerForm()
}},disableRoutePlannerForm:function(){mtt.routeplanner.searchSubmit.disabled=true;
mtt.routeplanner.searchSubmit.addClassName("disabled")
},enableRoutePlannerForm:function(){mtt.routeplanner.searchSubmit.disabled=false;
mtt.routeplanner.searchSubmit.removeClassName("disabled")
},onSearchFormSubmit:function(){if($("activeTab").value=="routeSearch"&&mtt.routeplanner.searchSubmit.hasClassName("disabled")){return false
}}};mtt.PoiHandler=JClass.extend({openedListItem:null,_pois:[],init:function(B,A){if(typeof mtt.page=="undefined"){mtt.page={}
}this.options={mapOptions:{center:new google.maps.LatLng(47.25686404408872,19.456787109375),zoom:7,streetViewControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:false,scaleControl:mtt.page.type=="routeplanner"}};
jQuery.extend(this.options,A);
if(!B){return 
}this._map=new google.maps.Map(B,this.options.mapOptions);
if(!this._map){return 
}if(!this.options.admin){}jQuery(B).mousemove(this.onMapMouseMove)
},showPOIs:function(){if(!this._map){return 
}if(mtt.page.type=="searchonmap"){this.closeOpenedListItem()
}this.zoomToAllPois()
},closeOpenedListItem:function(){if(this.openedListItem){var A=this.openedListItem;
A._listItemDetails.slideUp(500,jQuery.proxy(function(){A._listItem.css({border:"none"});
A._listItem.removeClass(A._listItemSelectedClass);
A._callingCard.hide();
A._marker.setIcon(A.getMarkerImage())
},this));
delete this.openedListItem
}},removePoisByType:function(B){var A=this._pois.collect(function(C){if(C.options.type==B){C._marker.setMap(null);
C.removeCallingCard();
return null
}return C
}.bind(this)).compact();
delete this._pois;
this.setPois(A)
},clear:function(){this._pois=[]
},addPoi:function(A){var B={gmap:this._map};
jQuery.extend(B,A);
var C=new mtt.PoiHandler.Poi(B);
this._pois.push(C)
},addPois:function(A){A.each(function(B){this.addPoi(B)
}.bind(this))
},detachEvents:function(){this._pois.invoke("detachEvents")
},attachEvents:function(){this._pois.invoke("attachEvents")
},zoomToAllPois:function(){this.zoomToPois(this._pois)
},zoomToPois:function(C){var A=0,D=0,E=0,B=0;
if(C&&C.length==1){this._map.setOptions({center:new google.maps.LatLng(C[0]._marker.position.lat(),C[0]._marker.position.lng()),zoom:13})
}else{if(C&&C.length>0){C.each(function(F){if(A==0){A=D=F._marker.position.lng()
}else{if(F._marker.position.lng()<A){A=F._marker.position.lng()
}else{if(F._marker.position.lng()>D){D=F._marker.position.lng()
}}}if(E==0){E=B=F._marker.position.lat()
}else{if(F._marker.position.lat()<E){E=F._marker.position.lat()
}else{if(F._marker.position.lat()>B){B=F._marker.position.lat()
}}}});
if(A==D&&E==B){this._map.setCenter(new google.maps.LatLng(E,A))
}else{this._map.fitBounds(new google.maps.LatLngBounds(new google.maps.LatLng(E,A),new google.maps.LatLng(B,D)))
}}}},getPois:function(){return this._pois
},setPois:function(A){this._pois=A
}});mtt.PoiHandler.Poi=JClass.extend({_marker:null,_hidingTimer:null,_adId:null,options:null,init:function(A){this.options={};
jQuery.extend(this.options,A);
this._adId=this.options.adId;
var B=this.getMarkerImage();
this.options.x=this.options.x=="0.0"?(Math.random()*2)+29:this.options.x;
this.options.y=this.options.y=="0.0"?(Math.random()*2)+47:this.options.y;
this._marker=new google.maps.Marker({position:new google.maps.LatLng(this.options.y,this.options.x),map:this.options.gmap,clickable:true,draggable:this.options.type=="draggable",labelClass:"poi type_"+this.options.type+" subtype_"+this.options.subtype,labelText:this.options.label,icon:B});
if(this._adId){}this.attachEvents();
google.maps.event.addListener(this._marker,"dragend",this.options.onDragEnd);
google.maps.event.addListener(this._marker,"mouseover",jQuery.proxy(this.onPoiMouseOver,this));
google.maps.event.addListener(this._marker,"mouseout",jQuery.proxy(this.onPoiMouseOut,this));
google.maps.event.addListener(this._marker,"click",jQuery.proxy(this.onPoiClick,this))
},getMarkerImage:function(B){var C=null;
var A=B!=null?"on":"";
switch(this.options.type){case"address":C=new google.maps.MarkerImage(mtt.url.poi["address"+A],null,null,new google.maps.Point(13,13));
break;
case"topranked":C=new google.maps.MarkerImage(mtt.url.poi["toprank"+A],null,null,new google.maps.Point(13,13));
break;
case"servicepoi":C=new google.maps.MarkerImage(this.options.label==""?mtt.url.poi["blank"+A]:mtt.url.poi["num_"+this.options.label+A],null,null,new google.maps.Point(13,13));
break;
case"importantPoiType":C=new google.maps.MarkerImage(mtt.url.poi["blank"+A],null,null,new google.maps.Point(13,13));
break;
case"clickpage":C=new google.maps.MarkerImage(mtt.url.poi["draggable"+A],null,null,new google.maps.Point(13,13));
break;
case"draggable":C=new google.maps.MarkerImage(mtt.url.poi["draggable"+A],null,null,new google.maps.Point(13,13));
break;
default:C=new google.maps.MarkerImage(mtt.url.poi["blank"+A],null,null,new google.maps.Point(13,13));
break}return C
},onPoiMouseOver:function(){if(mtt.page.type=="searchonmap"&&this.options.type!="important"){this.highlight()
}else{this.showCallingCard("poi")
}},onPoiMouseOut:function(){if(mtt.page.type=="searchonmap"&&this.options.type!="important"){this.highlightOut("poi")
}else{this.hideCallingCard("poi")
}},onPoiClick:function(){if(mtt.page.type=="searchonmap"&&this.options.type!="important"){this.toggleListItem({},"poi")
}},attachEvents:function(){this.detachEvents();
if(this.options.type=="address"&&!mtt.page.printableVersion&&this.options.address!=null){if(!this._cc){this._cc=jQuery('<div style="display: none;" id="card_'+this._adId+'" class="callingCard callingCardAddress"><div class="top"></div><div class="content margined clearfix"><h3>'+this.options.address+'</h3><ul class="commands"><li><a onclick="window.location = \'/redirect.jspv?method=Redirect&url=/utvonalterv.jspv%3Fto%3D%26from%3D'+escape(this.options.address)+"%26fromX%3D"+this.options.x+"%26fromY%3D"+this.options.y+'%26activeTab%3DrouteSearch\'; return false;" href="#" rel="nofollow,noindex">Útvonaltervezés innen</a> / <a onclick="window.location = \'/redirect.jspv?method=Redirect&url=/utvonalterv.jspv%3Ffrom%3D%26to%3D'+escape(this.options.address)+"%26toX%3D"+this.options.x+"%26toY%3D"+this.options.y+'%26activeTab%3DrouteSearch\'; return false;" href="#" rel="nofollow,noindex">ide</a></li></ul></div><div class="bottom"></div></div>');
jQuery(document.body).append(this._cc)
}}this._poiItem=jQuery("#poi_"+this._adId);
this._callingCard=jQuery("#card_"+this._adId);
this._callingCardBtn=jQuery("#callingCardBtn_"+this._adId);
this._callingCardReversedVClassName="callingCardReversedV"+this.options.type;
this._callingCardReversedHClassName="callingCardReversedH"+this.options.type;
this._callingCardReversedHVClassName="callingCardReversedHV"+this.options.type;
this._listItem=jQuery("#listItem_"+this._adId);
this._listItemTitle=jQuery("#listItemTitle_"+this._adId);
this._listItemDetails=jQuery("#listItemDetails_"+this._adId);
this._listItemSelectedClass="listItemSelected"+((this._adId.indexOf("topRanked_")==0)?"Toprank":"");
if((this._listItem.length>0)&&mtt.page.type=="searchonmap"){this._listItem.live("mouseover",jQuery.proxy(this.highlight,this));
this._listItem.live("mouseout",jQuery.proxy(this.highlightOut,this))
}if(this._callingCardBtn.length>0){this._callingCardBtn.live("mouseover",jQuery.proxy(this.showCallingCard,this,this._callingCardBtn));
this._callingCardBtn.live("mouseout",jQuery.proxy(this.hideCallingCard,this,this._callingCardBtn))
}if(this._callingCard.length>0){this._callingCard.live("mouseover",jQuery.proxy(this.showCallingCard,this,this._callingCard));
this._callingCard.live("mouseout",jQuery.proxy(this.hideCallingCard,this,this._callingCard))
}if((this._listItemTitle.length>0)&&(this._listItemDetails.length>0)&&mtt.page.type=="searchonmap"){this._listItemTitle.live("click",jQuery.proxy(this.toggleListItem,this))
}if(!this.dragAttachedEvents&&this.options.draggable){jQuery(this._marker.div_).draggable({start:jQuery.proxy(this.onMarkerDragStart,this),drag:jQuery.proxy(this.onMarkerDragging,this),stop:jQuery.proxy(this.onMarkerDrop,this)});
this.dragAttachedEvents=true
}},onMarkerDragStart:function(A){},onMarkerDragging:function(){},onMarkerDrop:function(){},detachEvents:function(){if(this._cc){this._cc.die();
this._cc.remove();
this._cc=null
}this._poiItem&&this._poiItem.die();
this._callingCard&&this._callingCard.die();
this._callingCardBtn&&this._callingCardBtn.die();
this._listItem&&this._listItem.die();
this._listItemTitle&&this._listItemTitle.die();
this._listItemDetails&&this._listItemDetails.die()
},getMarkerPos:function(){var D=Math.pow(2,this._marker.getMap().getZoom());
var A=new google.maps.LatLng(this._marker.getMap().getBounds().getNorthEast().lat(),this._marker.getMap().getBounds().getSouthWest().lng());
var C=this._marker.getMap().getProjection().fromLatLngToPoint(A);
var B=this._marker.getMap().getProjection().fromLatLngToPoint(this._marker.getPosition());
return new google.maps.Point(Math.floor((B.x-C.x)*D),Math.floor((B.y-C.y)*D))
},showCallingCard:function(C,F){if(this._callingCard.length==0){return 
}if(this._hidingTimer){clearTimeout(this._hidingTimer);
delete this._hidingTimer;
C=this._callerElement
}else{this._callerElement=C
}if(jQuery.browser.msie&&jQuery.browser.version=="6.0"&&!this._ieFix){this._ieFix=jQuery("<iframe />",{id:this._callingCard.id+"_iefix",style:"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);z-index: 9",src:"javascript:false;",frameborder:"0",scrolling:"no"});
this._callingCard.after(this._ieFix)
}if(C=="poi"){var H=this.getMarkerPos();
var B=jQuery(this._marker.getMap().getDiv()).position();
var A=[H.x+B.left-180,H.y+B.top+6]
}else{var A=[C.offset().left-169,C.offset().top+20]
}this._callingCard.css({left:A[0]+"px",top:A[1]+"px",display:"block"});
var E=jQuery(window).scrollTop()+jQuery(window).height()-10;
var D=A[1]+20+this._callingCard.height();
var G=this._callingCard.position().left+parseInt(this._callingCard.css("margin-left"))-jQuery(window).scrollLeft()-10;
if(D>E){if(this._callingCard.hasClass(this._callingCardReversedHVClassName)){}else{if(this._callingCard.hasClass(this._callingCardReversedHClassName)){this._callingCard.removeClass(this._callingCardReversedHClassName);
this._callingCard.addClass(this._callingCardReversedHVClassName)
}else{this._callingCard.addClass(this._callingCardReversedVClassName)
}}this._callingCard.css({top:A[1]-this._callingCard.height()+"px"})
}else{if(this._callingCard.hasClass(this._callingCardReversedHVClassName)){this._callingCard.removeClass(this._callingCardReversedHVClassName);
this._callingCard.addClass(this._callingCardReversedHClassName)
}else{this._callingCard.removeClass(this._callingCardReversedVClassName)
}}if(G<0){if(this._callingCard.hasClass(this._callingCardReversedVClassName)){this._callingCard.removeClass(this._callingCardReversedVClassName);
this._callingCard.addClass(this._callingCardReversedHVClassName)
}else{if(!this._callingCard.hasClass(this._callingCardReversedHVClassName)){this._callingCard.addClass(this._callingCardReversedHClassName)
}}}this._ieFix&&this._ieFix.css({left:A[0]+parseInt(this._callingCard.position().left)+"px",top:A[1]+"px",width:this._callingCard.width()+"px",height:this._callingCard.height()+"px",display:"block"});
this._callingCard.show();
this._marker.setIcon(this.getMarkerImage(true))
},hideCallingCard:function(A,B){if(this._callingCard.length==0){return 
}this._hidingTimer=setTimeout(this.hideLogic.bind(this,A,B),50)
},removeCallingCard:function(){this._callingCard.remove()
},hideLogic:function(A,B){this._callingCard.hide();
if(this._poiItem&&mtt.poiHandler.openedListItem!=this){this._marker.setIcon(this.getMarkerImage())
}this._ieFix&&this._ieFix.hide();
delete this._hidingTimer
},toggleListItem:function(A){if(A&&A.currentTarget&&(A.currentTarget.tagName.toLowerCase()=="a")&&this._listItemDetails.is(":visible")){return true
}if(!this._listItemDetails){return false
}if(this._listItemDetails.is(":visible")){delete mtt.poiHandler.openedListItem;
this._listItemDetails.slideUp(500,jQuery.proxy(function(){this._listItem.css({border:"none"})
},this))
}else{this._listItem.css({border:"1px solid #dfdfdf"});
mtt.poiHandler.closeOpenedListItem();
this._listItemDetails.slideDown(500,jQuery.proxy(function(){mtt.poiHandler.openedListItem=this;
this.highlight()
},this))
}return false
},highlight:function(){if(this._marker){var A=this.getMarkerImage(true);
this._marker.setIcon(A)
}this._listItem.addClass(this._listItemSelectedClass)
},highlightOut:function(){if(this._listItemDetails.is(":visible")){return 
}this._listItem.removeClass(this._listItemSelectedClass);
if(this._marker&&mtt.poiHandler.openedListItem!=this){var A=this.getMarkerImage();
this._marker.setIcon(A)
}}});mtt.importantPlaces={init:function(){if(!$("importantPlaces")){return 
}mtt.importantPlaces.checkBoxes=$("importantPlaces").getElementsBySelector("input");
mtt.importantPlaces.checkBoxes.each(function(B){B.observe("click",mtt.importantPlaces.checkBoxValueChanged)
});var A=new Element("div",{id:"importantPlacesContainer"});
document.body.appendChild(A)
},checkBoxValueChanged:function(A){clearTimeout(mtt.importantPlaces.timer);
if(!A.element().checked){A.element().up().className="";
mtt.importantPlaces.timer=setTimeout("mtt.importantPlaces.requestPOIs();",1000);
return 
}if($("importantPlaces").getElementsBySelector(".selected1").length>0&&$("importantPlaces").getElementsBySelector(".selected2").length>0){mtt.showMessage(mtt.lang.impPlcsTooManyChecked,"error");
A.element().checked=false;
return 
}if($("importantPlaces").getElementsBySelector(".selected1").length==0){A.element().up().addClassName("selected1")
}else{A.element().up().addClassName("selected2")
}mtt.importantPlaces.timer=setTimeout("mtt.importantPlaces.requestPOIs();",1000)
},requestPOIs:function(C){if(mtt.page=="searchonmap"){mtt.searchonmap.setBusyState(true)
}document.stopObserving("Map:mapStateChanged");
C&&C.stop&&C.stop();
var A=$("importantPlaces").down(".selected1 input");
A=A&&A.value;
var D=$("importantPlaces").down(".selected2 input");
D=D&&D.value;
var B=mtt.poiHandler._map.getBounds();
new mtt.Ajax.Request(mtt.url.importantPlaces,{method:"get",parameters:{type1:A,type2:D,x0:B.getNorthEast().lng(),y0:B.getNorthEast().lat(),x1:B.getSouthWest().lng(),y1:B.getSouthWest().lat()},onComplete:mtt.importantPlaces.updateResultDiv})
},updateResultDiv:function(A,B,C){$("importantPlacesContainer").update(A.responseText);
mtt.poiHandler.removePoisByType("important");
setTimeout(function(){mtt.importantPOIs.items.each(function(D){mtt.poiHandler.pois.addPoi({adId:"important_"+D[0],x:D[1],y:D[2],tmp:D[3],type:D[4],poiClass:"importantPoiType",label:"",subtype:D[5]})
});mtt.poiHandler.showPOIs();
mtt.importantPlaces.showPOIs()
}.bind(this),100)
},showPOIs:function(){var A=$("tooMuchImportantPois");
if(A){var B=$("importantPlacesMapFilter").cumulativeOffset();
A.setStyle({left:B[0]+"px",top:B[1]+$("importantPlacesMapFilter").getHeight()+"px"});
A.show();
A.observe("click",A.hide)
}setTimeout("document.observe('Map:mapStateChanged', mtt.importantPlaces.requestPOIs);",1000);
if(mtt.importantPlaces.updateTimer){clearTimeout(mtt.importantPlaces.updateTimer);
delete mtt.importantPlaces.updateTimer
}}};mtt.clickpage={raters:new Array(),init:function(){$("morePhoneNums")&&$("morePhoneNums").observe("click",function(C){$("morePhoneNums").hide();
$("morePhoneNumsContainer").show();
C.stop()
});$("morePhotos")&&$("morePhotos").observe("click",function(C){$("morePhotos").hide();
$("morePhotosContainer").show();
C.stop()
});if(mtt.page.flashParams){if(Prototype.Browser.IE){$("flashGallery").update('<embed src="'+mtt.page.flashParams.data+'" width="'+mtt.page.flashParams.width+'" height="'+mtt.page.flashParams.height+'" bgcolor="'+mtt.page.flashParams.bgColor+'" flashvars="'+mtt.page.flashParams.flashVars+'" loop="'+mtt.page.flashParams.loop+'" menu="'+mtt.page.flashParams.menu+'" quality="'+mtt.page.flashParams.quality+'" scale="'+mtt.page.flashParams.scale+'" name="'+mtt.page.flashParams.flashName+'" align="'+mtt.page.flashParams.align+'" allowScriptAccess="'+mtt.page.flashParams.allowScriptAccess+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
}else{$("flashGallery").update('<object type="application/x-shockwave-flash" data="'+mtt.page.flashParams.data+'" width="'+mtt.page.flashParams.width+'" height="'+mtt.page.flashParams.height+'" id="'+mtt.page.flashParams.flashName+'" align="'+mtt.page.flashParams.align+'"><param name="movie" value="'+mtt.page.flashParams.data+'"><param name="allowScriptAccess" value="'+mtt.page.flashParams.allowScriptAccess+'"/><param name="quality" value="'+mtt.page.flashParams.quality+'"/><param name="bgcolor" value="'+mtt.page.flashParams.bgColor+'"/><param name="FlashVars" value="'+mtt.page.flashParams.flashVars+'"/></object>')
}}if(document.getElementsByClassName("rating").length!=0){for(var B=0;
B<5;B++){$("starRater"+B)&&this.raters.push(new mtt.starRater("starRater"+B,"starRaterMy"+B,this.raterClick.bind(this,B,mtt.page.advert[0])))
}}if($("map")&&mtt.page.advert[1]&&mtt.page.advert[2]){mtt.poiHandler.addPoi({adId:"000",x:mtt.page.advert[1],y:mtt.page.advert[2],type:"clickpage",label:"*"});
mtt.poiHandler.zoomToAllPois()
}if(typeof galleryConf=="object"){var A=galleryConf.images.split("&");
for(B=0;
B<A.length;
B++){A[B]=A[B].split("=")[1]
}galleryConf.images=A;
new ImageFadeAccross(galleryConf)
}},raterClick:function(C,B,A){new mtt.Ajax.Request(mtt.url.starRater,{method:"get",parameters:{method:"Rate",advertid:B,ratingtype:C,ratingvalue:A},onComplete:this.raterUpdate})
},raterUpdate:function(G,E,F){var B=F.result.contentAsText.evalJSON();
var D=document.getElementsByClassName("star-rater-avgOfAd_"+B.advertId);
for(var A=0;
A<D.length;
A++){var C=$(D[A]);
C.getElementsByTagName("UL")[0].className="rate"+B.averageRating
}for(var A=0;
A<mtt.advertisement.raters.length;
A++){mtt.advertisement.raters[A].update($("starRater"+A),$("starRaterMy"+A),B.allRatings[A],B.userRatings[A])
}}};mtt.clickpageedit={init:function(){if($("langSelector")){mtt.clickpageedit.onLangSelectorChange();
$("langSelector").observe("change",mtt.clickpageedit.onLangSelectorChange)
}},onLangSelectorChange:function(D){var A=$("langSelector");
var B=A.options[A.options.selectedIndex];
var C=B.value;
$$(".localized").each(function(E){if(E.hasClassName(C)){E.show()
}else{E.hide()
}}.bind(this))
}};ImageFadeAccross=Class.create({initialize:function(B){this.options=Object.clone(B);
this.options.images[this.options.images.length]=this.options.images[0];
for(var C=0;
C<this.options.images.length;
C++){var A=this.options.divId+"-img-"+C;
$(this.options.divId).insert(new Element("div",{id:A,style:"width: "+this.options.width+"px; height: "+this.options.height+'px; background: white url("'+this.options.images[C]+'") no-repeat center; position: absolute; top: 0; left: 0; z-index: '+(100-C)}))
}var D=0;
setInterval(function(){var E=this.options.divId+"-img-"+D;
if(D==this.options.images.length-1){for(var F=0;
F<this.options.images.length;
F++){$(this.options.divId+"-img-"+F).show()
}new Effect.Fade($(this.options.divId+"-img-"+0),{duration:this.options.fadeOutTime});
D=1}else{new Effect.Fade($(E),{duration:this.options.fadeOutTime});
D++}}.bind(this),this.options.showImageTime)
},calculateSize:function(B,A){return[B,A]
}});Tooltip=Class.create({initialize:function(B,A){this.el=$(B);
var A=Object.extend({titleType:"none",titleText:"",backgroundColor:"",htmlClass:"toolTip",width:"100px",position:"default",showOnClick:false,showOnMouseOver:false,showOnFocus:false,showOnLoad:false,hideTimeOut:null,body:""},arguments[1]||{});
this.options=Object.clone(A);
this.setTitleType(this.options.titleType);
this.createEvents(this);
if(!this.options.group){this.options.group="default"
}if(!TooltipManagers[this.options.group]){TooltipManagers[this.options.group]=new TooltipManager()
}this.tooltipManager=TooltipManagers[this.options.group]
},createEvents:function(){if(this.hint){this.target=this.hint
}else{this.target=this.el
}if(this.options.showOnMouseOver=="true"){Event.observe(this.target,"mouseover",this.createTooltip.bindAsEventListener(this));
Event.observe(this.target,"mouseout",this.removeTooltipWithTimer.bindAsEventListener(this))
}if(this.options.showOnClick=="true"){Event.observe(this.target,"click",function(A){this.createTooltip(A);
setTimeout(this.removeTooltipWithTimer.bind(this),this.options.hideTimeOut)
}.bind(this))
}if(this.options.showOnFocus=="true"){Event.observe(this.target,"focus",this.createTooltip.bindAsEventListener(this));
Event.observe(this.target,"blur",this.removeTooltipWithTimer.bindAsEventListener(this))
}if(this.options.showOnLoad=="true"){document.observe("application:afterInit",function(A){this.createTooltip(A);
setTimeout(this.removeTooltipWithTimer.bind(this),this.options.hideTimeOut)
}.bind(this))
}},createTooltip:function(B){mouse_X=Event.pointerX(B);
mouse_Y=Event.pointerY(B);
X_pos=$(this.el).cumulativeOffset().left;
Y_pos=$(this.el).cumulativeOffset().top;
if(this.options.titleType=="ico"){X_pos=$(this.hint).cumulativeOffset().left;
Y_pos=$(this.hint).cumulativeOffset().top
}width=$(this.el).getDimensions().width;
height=$(this.el).getDimensions().height;
if(this.options.titleType=="ico"){width=$(this.hint).getDimensions().width;
height=$(this.hint).getDimensions().height
}if(!this.tooltip){this.tooltip=new Element("div");
this.tooltip.addClassName(this.options.htmlClass);
this.tooltipTop=new Element("div");
this.tooltipTop.addClassName("top");
this.tooltip.appendChild(this.tooltipTop);
this.tooltipContent=new Element("div");
this.tooltipContent.addClassName("content");
this.tooltip.appendChild(this.tooltipContent);
this.tooltipBottom=new Element("div");
this.tooltipBottom.addClassName("bottom");
this.tooltip.appendChild(this.tooltipBottom);
this.tooltipContent.update(this.options.body);
Element.setStyle(this.tooltip,{position:"absolute",left:X_pos+width+"px",top:Y_pos+height+"px",width:this.options.width,background:this.options.backgroundColor});
$(document.body).insert(this.tooltip);
if(this.isHiddenByParent()){this.tooltip.hide()
}this.tooltipManager.add(this)
}var A=document.viewport.getScrollOffsets()[1];
var C=document.viewport.getHeight();
if(A+C<Y_pos+this.tooltip.getHeight()+20){this.tooltip.addClassName("toolTipReversed");
this.tooltip.setStyle({left:X_pos+"px",top:Y_pos-this.tooltip.getHeight()+"px"});
this.topE&&this.topE.show();
this.bottomE&&this.bottomE.hide()
}else{this.tooltip.removeClassName("toolTipReversed");
this.tooltip.setStyle({left:X_pos+"px",top:Y_pos+"px"});
this.topE&&this.topE.hide();
this.bottomE&&this.bottomE.show()
}this.tooltipManager.showEvent(this)
},isHiddenByParent:function(){var A=false;
var B=this.el;
do{if(B.getStyle("display")=="none"&&!B.hasClassName("visibleHint")){A=true
}B=$(B.parentNode)
}while(B!=document.body);
return A
},setTitleType:function(A){switch(A){case"none":return false;
break;
case"text":this.hint=new Element("label");
this.hint.className="toolTipLabel";
this.hint.update(this.options.titleText);
this.el.insert({before:this.hint});
break;
case"ico":this.hint=$(this.el.id+"_hintIcon");
break}},removeTooltipWithTimer:function(){if(!this.hideTimeout){this.hideTimeout=setTimeout(this.removeTooltip.bind(this),this.options.hideTimeOut)
}},removeTooltip:function(){if(this.tooltip){this.tooltip.remove();
this.tooltipManager.remove(this);
delete this.tooltip
}delete this.hideTimeout
}});TooltipManager=Class.create({tooltips:[],initialize:function(){},add:function(A){this.tooltips.push(A)
},remove:function(A){this.tooltips.each(function(B){if(B==A){this.tooltips=this.tooltips.without(B)
}}.bind(this))
},showEvent:function(A){this.tooltips.each(function(B){if(B!=A){B.removeTooltip()
}}.bind(this))
}});TooltipManagers=[];
mtt.Behaviors={};
mtt.Behaviors.LinkTransporter=Behavior.create({onclick:function(B){B.stop();
if(!Prototype.Browser.IE){document.location.href=this.element.rev
}else{var A=new Element("a",{href:this.element.rev});
$(document.body).insert(A);
A.click()
}}});mtt.Behaviors.HomeNavigation=Behavior.create({onclick:function(B){var A=B.element().className;
if(A!=""&&A!="help"&&A!="cBox"&&B.element().tagName=="A"){B.stop();
$$("."+A)[0].simulate("click")
}}});Event.addBehavior({".linkTransporter":mtt.Behaviors.LinkTransporter,".homeCont":mtt.Behaviors.HomeNavigation});
mtt.Behaviors.NoProblemForm=Behavior.create({initialize:function(){this._seoLink="";
this._professionName="";
this.examineResults();
this._loadingIndicator=jQuery(".noproblemFormLoadingIndicator");
this._loadingIndicator.hide();
if((jQuery(this.element).find("input[name=autoStartNoProblem]").val()=="true")&&this._form.hasClass("remote")){jQuery(this.element).find("input[name=autoStartNoProblem]").val("false");
this.onFormSubmit()
}this._form.find("input, select, textarea").removeAttr("disabled");
if(!jQuery(".noproblemFormLoadingIndicator").length){jQuery(document.body).append(jQuery('<div class="noproblemFormLoadingIndicator"></div>'))
}},onFormSubmit:function(B){jQuery.each(this._form.find(".defaultValue"),function(E,F){if(!this._modified){jQuery(this).val("")
}});if(!this._form.hasClass("remote")){return 
}var C=$(this._form.get(0).id).serialize().toQueryParams();
this._form.find("input, select, textarea").attr("disabled","disabled");
new mtt.Ajax.Request(this._form.attr("action"),{method:this._form.attr("method"),asynchronous:true,parameters:C,contentType:"application/x-www-form-urlencoded",onComplete:function(F,G,H){var E=jQuery(F.responseText);
jQuery(".noProblemFormContainer").html(E);
this._loadingIndicator.hide();
this.examineResults()
}.bind(this)});
var D={width:jQuery("#noproblemForm").width(),height:jQuery("#noproblemForm").height()};
var A=jQuery("#noproblemForm").offset();
this._loadingIndicator.css({display:"block",width:D.width+"px",height:D.height+"px",left:A.left+"px",top:A.top+"px"});
return false
},examineResults:function(){this._form=jQuery(this.element).find("form");
this._form.submit(jQuery.proxy(this.onFormSubmit,this));
if(this._form.length>0){jQuery.each(this._form.find(".defaultValue"),function(B,C){new defaultValue(this)
});this._areaCode=this._form.find("input[name=areaCode]").val();
this._expertiseCode=this._form.find("input[name=expertiseCode]").val();
var A=this._form.find("input[name=seoLink]").val();
this._seoLink=A||this._seoLink;
A=this._form.find("input[name=professionName]").val();
this._professionName=A||this._professionName
}if(jQuery(".startPollingAuctions").length>0){if(this._form.length>0){this._form.hide()
}jQuery(".startPollingAuctions").remove();
this.poll()
}if(jQuery(".pendingAuctions").length>0){if(this._form.length>0){this._form.hide()
}setTimeout(this.poll.bind(this),10000)
}if(jQuery(".auctionStopped").length>0){if(this._form.length>0){this._form.hide()
}}},poll:function(){jQuery("#noProblemSuppliers").load(mtt.url.noproblemAuction,{areaCode:this._areaCode,expertiseCode:this._expertiseCode,seoLink:this._seoLink,professionName:this._professionName},jQuery.proxy(function(){this.examineResults()
},this))
}});mtt.Behaviors.NoProblemClassicForm=Behavior.create({onsubmit:function(A){jQuery.each(jQuery(this.element).find(".defaultValue"),function(B,C){if(!this._modified){jQuery(this).val("")
}})}});
Event.addBehavior({".noProblemFormContainer":mtt.Behaviors.NoProblemForm,".noProblemClassicForm":mtt.Behaviors.NoProblemClassicForm});
jQuery(document.body).delegate("#noproblemForm #phone","keyup",function(){jQuery(this).val(jQuery(this).val().replace(/[^0-9]/g,""))
});(function(){var B={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|mouse(?:down|up|over|move|out))$/};
var A={pointerX:0,pointerY:0,button:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,bubbles:true,cancelable:true};
Event.simulate=function(H,D){var F=Object.extend(A,arguments[2]||{});
var C,G=null;
H=$(H);
for(var E in B){if(B[E].test(D)){G=E;
break}}if(!G){throw new SyntaxError("Only HTMLEvents and MouseEvents interfaces are supported")
}if(document.createEvent){C=document.createEvent(G);
if(G=="HTMLEvents"){C.initEvent(D,F.bubbles,F.cancelable)
}else{C.initMouseEvent(D,F.bubbles,F.cancelable,document.defaultView,F.button,F.pointerX,F.pointerY,F.pointerX,F.pointerY,F.ctrlKey,F.altKey,F.shiftKey,F.metaKey,F.button,H)
}H.dispatchEvent(C)
}else{F.clientX=F.pointerX;
F.clientY=F.pointerY;
C=Object.extend(document.createEventObject(),F);
H.fireEvent("on"+D,C)
}return H
};Element.addMethods({simulate:Event.simulate})
})();
